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
Class GinjectorBindings

    java.lang.Object
      com.google.gwt.inject.rebind.GinjectorBindings

All Implemented Interfaces:
  BindingIndex

    public class GinjectorBindings

extends java.lang.Object
implements BindingIndex

Stores information that describes the bindings present in a given injector, and the relationship to the other injectors in the hierarchy. This class is used in two stages:

- During bindings processing `BindingsProcessor` this gathers up explicit bindings and unresolved dependencies. After all bindings have been gathered from the modules, `resolveBindings()` is called in the last stage of processing and it is finalized. After that point, no new unresolved bindings should be added.
- At this point, it is ready to be used by `GinjectorOutputter` for generating the Ginjector implementation. In this stage several additional methods are available for getting information about the code that has been generated to represent this ginjector.

Each `GinjectorBindings` can have a parent ginjector, and any number of child ginjectors.

Constructor Summary
`GinjectorBindings(NameGenerator nameGenerator, com.google.gwt.core.ext.TreeLogger logger, GuiceUtil guiceUtil, java.lang.Class<? extends Ginjector> ginjectorInterface, javax.inject.Provider<GinjectorBindings> ginjectorBindingsProvider, MemberCollector collector, ErrorManager errorManager, BindingResolver bindingResolver)`

Method Summary
`void` | `addBinding(Key<?> key, Binding binding)`
`void` | `addDependencies(java.util.Collection<Dependency> dependencies)`
`void` | `addDependency(Dependency dependency)`
`void` | `addFactoryModule(FactoryModule<?> install)`
`void` | `addPin(Key<?> key)`
`GinjectorBindings` | `createChildGinjectorBindings(java.lang.Class<?> module)` Create a new `GinjectorBindings` that collects bindings for an injector that is the child of this `GinjectorBindings`.
`GinScope` | `determineScope(Key<?> key)`
`Binding` | `getBinding(Key<?> key)`
`java.lang.Iterable<java.util.Map.Entry<Key<?>,Binding>>` | `getBindings()`
`java.lang.Iterable<Key<?>>` | `getBoundKeys()`
`java.lang.Iterable<GinjectorBindings>` | `getChildren()`
`GinjectorBindings` | `getChildWhichBindsLocally(Key<?> key)` Returns the child injector which binds the given key.
`java.lang.Iterable<Dependency>` | `getDependencies()`
`java.lang.Iterable<FactoryModule<?>>` | `getFactoryModules()`
`TypeLiteral<?>` | `getGinjectorInterface()`
`java.lang.Iterable<TypeLiteral<?>>` | `getMemberInjectRequests()`
`java.lang.Class<?>` | `getModule()`
`java.lang.String` | `getModuleName()`
`NameGenerator` | `getNameGenerator()`
`GinjectorBindings` | `getParent()`
`java.util.Collection<java.lang.Class<?>>` | `getStaticInjectionRequests()`
`boolean` | `hasEagerSingletonBindingInSubtree()` Returns `true` if any binding in this injector or in one of its descendants is an eager singleton binding.
`boolean` | `hasStaticInjectionRequestInSubtree()` Returns `true` if this injector or any of its children has a static injection request.
`boolean` | `isBound(Key<?> key)` Returns true if the passed key is bound in the Ginjector.
`boolean` | `isBoundLocallyInChild(Key<?> key)`
`boolean` | `isPinned(Key<?> key)`
`void` | `resolveBindings()`
`void` | `setModule(java.lang.Class<?> module)`
`void` | `setParent(GinjectorBindings parent)`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### GinjectorBindings

    @Inject
    public GinjectorBindings(NameGenerator nameGenerator,
                                    com.google.gwt.core.ext.TreeLogger logger,
                                    GuiceUtil guiceUtil,
                                    java.lang.Class<? extends Ginjector> ginjectorInterface,
                                    javax.inject.Provider<GinjectorBindings> ginjectorBindingsProvider,
                                    MemberCollector collector,
                                    ErrorManager errorManager,
                                    BindingResolver bindingResolver)

Method Detail

### createChildGinjectorBindings

    public GinjectorBindings createChildGinjectorBindings(java.lang.Class<?> module)

  Create a new `GinjectorBindings` that collects bindings for an injector that is the child of this `GinjectorBindings`.

  Parameters:
    `module` - the module the ginjector is being created for
  Returns:
    the child `GinjectorBindings`

### resolveBindings

    public void resolveBindings()
                         throws com.google.gwt.core.ext.UnableToCompleteException

  Throws:
    `com.google.gwt.core.ext.UnableToCompleteException`

### getDependencies

    public java.lang.Iterable<Dependency> getDependencies()

### getBoundKeys

    public java.lang.Iterable<Key<?>> getBoundKeys()

### getBindings

    public java.lang.Iterable<java.util.Map.Entry<Key<?>,Binding>> getBindings()

### getGinjectorInterface

    public TypeLiteral<?> getGinjectorInterface()

### getStaticInjectionRequests

    public java.util.Collection<java.lang.Class<?>> getStaticInjectionRequests()

### getMemberInjectRequests

    public java.lang.Iterable<TypeLiteral<?>> getMemberInjectRequests()

### hasEagerSingletonBindingInSubtree

    public boolean hasEagerSingletonBindingInSubtree()

  Returns `true` if any binding in this injector or in one of its descendants is an eager singleton binding.

  Note: this method is Omega(n) in the height of the injector tree, and invoking it on every entry in the injector tree is O(n^2). The latter cost could be reduced to O(n) by caching the return value.

### hasStaticInjectionRequestInSubtree

    public boolean hasStaticInjectionRequestInSubtree()

  Returns `true` if this injector or any of its children has a static injection request.

  Note: this method is Omega(n) in the height of the injector tree, and invoking it on every entry in the injector tree is O(n^2). The latter cost could be reduced to O(n) by caching the return value.

### getParent

    public GinjectorBindings getParent()

### setParent

    public void setParent(GinjectorBindings parent)

### getModule

    public java.lang.Class<?> getModule()

### getModuleName

    public java.lang.String getModuleName()

### setModule

    public void setModule(java.lang.Class<?> module)

### getChildren

    public java.lang.Iterable<GinjectorBindings> getChildren()

### getFactoryModules

    public java.lang.Iterable<FactoryModule<?>> getFactoryModules()

### getNameGenerator

    public NameGenerator getNameGenerator()

### determineScope

    public GinScope determineScope(Key<?> key)

### isBound

    public boolean isBound(Key<?> key)

  Description copied from interface: `BindingIndex`
  Returns true if the passed key is bound in the Ginjector.

  Note: This only works reliably in the source-generation phase of the ginjector generation since during the binding processing phase not all keys are guaranteed to have been looked at.

  Specified by:
    `isBound` in interface `BindingIndex`
  Parameters:
    `key` - key to be checked
  Returns:
    true if key is bound.

### getBinding

    public Binding getBinding(Key<?> key)

### addDependency

    public void addDependency(Dependency dependency)

### addDependencies

    public void addDependencies(java.util.Collection<Dependency> dependencies)

### addBinding

    public void addBinding(Key<?> key,
                           Binding binding)

### addPin

    public void addPin(Key<?> key)

### isPinned

    public boolean isPinned(Key<?> key)

### isBoundLocallyInChild

    public boolean isBoundLocallyInChild(Key<?> key)

### getChildWhichBindsLocally

    public GinjectorBindings getChildWhichBindsLocally(Key<?> key)

  Returns the child injector which binds the given key. If no child binds the key, returns `null`.

### addFactoryModule

    public void addFactoryModule(FactoryModule<?> install)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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