Constructor and Description |
---|
GuiceUtil(MemberCollector memberCollector) |
Modifier and Type | Method and Description |
---|---|
Collection<Dependency> |
getDependencies(Key<?> typeKey,
MethodLiteral<?,?> method)
Collects and returns all keys required to inject the given method.
|
Key<?> |
getKey(FieldLiteral<?> field)
Returns a key based on the passed field, taking any binding annotations
into account.
|
Key<?> |
getKey(MethodLiteral<?,?> method)
Retrieves a key based on the passed
Ginjector method. |
Collection<Dependency> |
getMemberInjectionDependencies(Key<?> typeKey,
TypeLiteral<?> type)
Collects and returns all keys required to member-inject the given class.
|
static boolean |
hasInject(MemberLiteral<?,?> member)
Returns
true if the passed member has a inject annotation. |
boolean |
isMemberInject(MethodLiteral<?,?> method)
Returns true if the passed
Ginjector method is used for member
injection (i.e. |
boolean |
isOptional(MemberLiteral<?,?> member)
Returns true if the passed method has an @
Inject
annotation and the injection is marked as optional (
@Inject(optional = true) ). |
@Inject public GuiceUtil(MemberCollector memberCollector)
public Key<?> getKey(MethodLiteral<?,?> method)
Ginjector
method. If the
passed method is used for member injection, returns a key for the
parameter, otherwise for the method return type. Always uses the method's
binding annotation if present.method
- method for which to retrieve the keypublic Key<?> getKey(FieldLiteral<?> field)
field
- field for which to retrieve the keypublic boolean isMemberInject(MethodLiteral<?,?> method)
Ginjector
method is used for member
injection (i.e. takes exactly one parameter and returns void) or is a
regular Ginjector
method that returns a type.method
- method to be checkedpublic boolean isOptional(MemberLiteral<?,?> member)
Inject
annotation and the injection is marked as optional (
@Inject(optional = true)
).
Note that Inject
does not have an optional parameter
and therefore cannot be optional.member
- method to be checkedpublic Collection<Dependency> getMemberInjectionDependencies(Key<?> typeKey, TypeLiteral<?> type)
typeKey
- key causing member injectiontype
- class for which required keys are calculatedpublic Collection<Dependency> getDependencies(Key<?> typeKey, MethodLiteral<?,?> method)
typeKey
- the key that depends on injecting the arguments of methodmethod
- method for which required keys are calculatedpublic static boolean hasInject(MemberLiteral<?,?> member)
true
if the passed member has a inject annotation.Copyright © 2008–2018. All rights reserved.