public class GinjectorBindings extends Object implements BindingIndex
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.
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 and Description |
---|
GinjectorBindings(NameGenerator nameGenerator,
TreeLogger logger,
GuiceUtil guiceUtil,
Class<? extends Ginjector> ginjectorInterface,
javax.inject.Provider<GinjectorBindings> ginjectorBindingsProvider,
MemberCollector collector,
ErrorManager errorManager,
BindingResolver bindingResolver) |
@Inject public GinjectorBindings(NameGenerator nameGenerator, TreeLogger logger, GuiceUtil guiceUtil, Class<? extends Ginjector> ginjectorInterface, javax.inject.Provider<GinjectorBindings> ginjectorBindingsProvider, MemberCollector collector, ErrorManager errorManager, BindingResolver bindingResolver)
public GinjectorBindings createChildGinjectorBindings(Class<?> module)
GinjectorBindings
that collects bindings for an injector that is the
child of this GinjectorBindings
.module
- the module the ginjector is being created forGinjectorBindings
public void resolveBindings() throws UnableToCompleteException
UnableToCompleteException
public Iterable<Dependency> getDependencies()
public TypeLiteral<?> getGinjectorInterface()
public Collection<Class<?>> getStaticInjectionRequests()
public Iterable<TypeLiteral<?>> getMemberInjectRequests()
public boolean hasEagerSingletonBindingInSubtree()
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.
public boolean hasStaticInjectionRequestInSubtree()
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.
public GinjectorBindings getParent()
public void setParent(GinjectorBindings parent)
public Class<?> getModule()
public String getModuleName()
public void setModule(Class<?> module)
public Iterable<GinjectorBindings> getChildren()
public Iterable<FactoryModule<?>> getFactoryModules()
public NameGenerator getNameGenerator()
public boolean isBound(Key<?> key)
BindingIndex
isBound
in interface BindingIndex
key
- key to be checkedpublic void addDependency(Dependency dependency)
public void addDependencies(Collection<Dependency> dependencies)
public void addPin(Key<?> key)
public boolean isPinned(Key<?> key)
public boolean isBoundLocallyInChild(Key<?> key)
public GinjectorBindings getChildWhichBindsLocally(Key<?> key)
null
.public void addFactoryModule(FactoryModule<?> install)
Copyright © 2008–2018. All rights reserved.