public abstract class Binding<T> extends Object implements javax.inject.Provider<T>, MembersInjector<T>
Modifier and Type | Class and Description |
---|---|
static class |
Binding.InvalidBindingException
An exception thrown by anything attempting to construct a binding which is invalid.
|
Modifier and Type | Field and Description |
---|---|
protected static boolean |
IS_SINGLETON |
String |
membersKey
The key used to inject members of 'T', or null if this binding cannot inject members.
|
protected static boolean |
NOT_SINGLETON |
String |
provideKey
The key used to provide instances of 'T', or null if this binding cannot provide instances.
|
Object |
requiredBy |
static Binding<Object> |
UNRESOLVED |
Modifier | Constructor and Description |
---|---|
protected |
Binding(String provideKey,
String membersKey,
boolean singleton,
Object requiredBy) |
Modifier and Type | Method and Description |
---|---|
void |
attach(Linker linker)
Links this binding to its dependencies.
|
boolean |
dependedOn() |
T |
get() |
void |
getDependencies(Set<Binding<?>> getBindings,
Set<Binding<?>> injectMembersBindings)
Populates
getBindings and injectMembersBindings with the
bindings used by this binding to satisfy get() and injectMembers(T) calls, respectively. |
void |
injectMembers(T t)
Injects dependencies into the fields and methods of
instance . |
boolean |
isCycleFree() |
boolean |
isLinked() |
boolean |
isVisiting() |
boolean |
library() |
void |
setCycleFree(boolean cycleFree) |
void |
setDependedOn(boolean dependedOn) |
void |
setLibrary(boolean library) |
void |
setVisiting(boolean visiting) |
String |
toString() |
protected static final boolean IS_SINGLETON
protected static final boolean NOT_SINGLETON
public final String provideKey
public final String membersKey
public final Object requiredBy
public void attach(Linker linker)
public void injectMembers(T t)
MembersInjector
instance
.
Ignores the presence or absence of an injectable constructor.
Whenever the object graph creates an instance, it performs this injection automatically (after first performing constructor injection), so if you're able to let the object graph create all your objects for you, you'll never need to use this method.
injectMembers
in interface MembersInjector<T>
t
- to inject members on. May be null
.public void getDependencies(Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings)
getBindings
and injectMembersBindings
with the
bindings used by this binding to satisfy get()
and injectMembers(T)
calls, respectively.getBindings
- the bindings required by this binding's get
method. Although get
usually calls into injectMembers
,
this does not contain the injectMembers bindings.injectMembersBindings
- the bindings required by this binding's injectMembers
method.public boolean isLinked()
public boolean isVisiting()
public void setVisiting(boolean visiting)
public boolean isCycleFree()
public void setCycleFree(boolean cycleFree)
public void setLibrary(boolean library)
public boolean library()
public void setDependedOn(boolean dependedOn)
public boolean dependedOn()
Copyright © 2018 Square, Inc.. All rights reserved.