Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.inject.rebind.util
Class GuiceUtil

    java.lang.Object
      com.google.gwt.inject.rebind.util.GuiceUtil

    public class GuiceUtil

extends java.lang.Object

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

### GuiceUtil

    @Inject
    public GuiceUtil(MemberCollector memberCollector)

Method Detail

### getKey

    public Key<?> getKey(MethodLiteral<?,?> method)

  Retrieves a key based on the passed `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.

  Parameters:
    `method` - method for which to retrieve the key
  Returns:
    key based on passed method

### getKey

    public Key<?> getKey(FieldLiteral<?> field)

  Returns a key based on the passed field, taking any binding annotations into account.

  Parameters:
    `field` - field for which to retrieve the key
  Returns:
    key for passed field

### isMemberInject

    public boolean isMemberInject(MethodLiteral<?,?> method)

  Returns true if the passed `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.

  Parameters:
    `method` - method to be checked
  Returns:
    true if the passed method is used for member injection

### isOptional

    public boolean isOptional(MemberLiteral<?,?> member)

  Returns true if the passed method has an @`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.

  Parameters:
    `member` - method to be checked
  Returns:
    true if method is injected optionally

### getMemberInjectionDependencies

    public java.util.Collection<Dependency> getMemberInjectionDependencies(Key<?> typeKey,
                                                                           TypeLiteral<?> type)

  Collects and returns all keys required to member-inject the given class.

  Parameters:
    `typeKey` - key causing member injection
    `type` - class for which required keys are calculated
  Returns:
    keys required to inject given class

### getDependencies

    public java.util.Collection<Dependency> getDependencies(Key<?> typeKey,
                                                            MethodLiteral<?,?> method)

  Collects and returns all keys required to inject the given method.

  Parameters:
    `typeKey` - the key that depends on injecting the arguments of method
    `method` - method for which required keys are calculated
  Returns:
    required keys

### hasInject

    public static boolean hasInject(MemberLiteral<?,?> member)

  Returns `true` if the passed member has a inject annotation.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD