|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.gwt.inject.rebind.util.GuiceUtil
public class GuiceUtil
Util object that offers helper methods which can retrieve Keys
and additional dependency injection information on types or members.
| Constructor Summary | |
|---|---|
GuiceUtil(MemberCollector memberCollector)
|
|
| Method Summary | |
|---|---|
java.util.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. |
java.util.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)). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Inject public GuiceUtil(MemberCollector memberCollector)
| Method Detail |
|---|
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 key
public Key<?> getKey(FieldLiteral<?> field)
field - field for which to retrieve the key
public 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 checked
public 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 checked
public java.util.Collection<Dependency> getMemberInjectionDependencies(Key<?> typeKey,
TypeLiteral<?> type)
typeKey - key causing member injectiontype - class for which required keys are calculated
public java.util.Collection<Dependency> getDependencies(Key<?> typeKey,
MethodLiteral<?,?> method)
typeKey - the key that depends on injecting the arguments of methodmethod - method for which required keys are calculated
public static boolean hasInject(MemberLiteral<?,?> member)
true if the passed member has a inject annotation.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||