public final class ReflectiveAtInjectBinding<T> extends Binding<T>
@Inject
-annotated fields and constructors of a class
using reflection.Binding.InvalidBindingException
IS_SINGLETON, membersKey, NOT_SINGLETON, provideKey, requiredBy, UNRESOLVED
Modifier and Type | Method and Description |
---|---|
void |
attach(Linker linker)
Links this binding to its dependencies.
|
static <T> Binding<T> |
create(Class<T> type,
boolean mustHaveInjections) |
T |
get() |
void |
getDependencies(Set<Binding<?>> get,
Set<Binding<?>> injectMembers)
Populates
getBindings and injectMembersBindings with the
bindings used by this binding to satisfy Binding.get() and Binding.injectMembers(T) calls, respectively. |
void |
injectMembers(T t)
Injects dependencies into the fields and methods of
instance . |
String |
toString() |
dependedOn, isCycleFree, isLinked, isVisiting, library, setCycleFree, setDependedOn, setLibrary, setVisiting
public void attach(Linker linker)
Binding
public T get()
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>
injectMembers
in class Binding<T>
t
- to inject members on. May be null
.public void getDependencies(Set<Binding<?>> get, Set<Binding<?>> injectMembers)
Binding
getBindings
and injectMembersBindings
with the
bindings used by this binding to satisfy Binding.get()
and Binding.injectMembers(T)
calls, respectively.getDependencies
in class Binding<T>
get
- the bindings required by this binding's get
method. Although get
usually calls into injectMembers
,
this does not contain the injectMembers bindings.injectMembers
- the bindings required by this binding's injectMembers
method.Copyright © 2017 Square, Inc.. All rights reserved.