public final class SetBinding<T> extends Binding<Set<T>>
Binding<T>
which contains contributors (other bindings marked with
@Provides
@OneOf
), to which it delegates provision
requests on an as-needed basis.Binding.InvalidBindingException
IS_SINGLETON, membersKey, NOT_SINGLETON, provideKey, requiredBy, UNRESOLVED
Constructor and Description |
---|
SetBinding(SetBinding<T> original)
Creates a new
SetBinding with all of the contributing bindings of the provided
original SetBinding . |
SetBinding(String key,
Object requiredBy)
Creates a new
SetBinding with the given "provides" key, and the requiredBy object
for traceability. |
Modifier and Type | Method and Description |
---|---|
static <T> void |
add(BindingsGroup bindings,
String setKey,
Binding<?> binding) |
void |
attach(Linker linker)
Links this binding to its dependencies.
|
Set<T> |
get() |
void |
getDependencies(Set<Binding<?>> getBindings,
Set<Binding<?>> injectMembersBindings)
Populates
getBindings and injectMembersBindings with the
bindings used by this binding to satisfy Binding.get() and Binding.injectMembers(T) calls, respectively. |
void |
injectMembers(Set<T> t)
Injects dependencies into the fields and methods of
instance . |
int |
size() |
String |
toString() |
dependedOn, isCycleFree, isLinked, isVisiting, library, setCycleFree, setDependedOn, setLibrary, setVisiting
public SetBinding(String key, Object requiredBy)
SetBinding
with the given "provides" key, and the requiredBy object
for traceability.public SetBinding(SetBinding<T> original)
SetBinding
with all of the contributing bindings of the provided
original SetBinding
.public static <T> void add(BindingsGroup bindings, String setKey, Binding<?> binding)
public void attach(Linker linker)
Binding
public int size()
public void getDependencies(Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings)
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<Set<T>>
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 void injectMembers(Set<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<Set<T>>
injectMembers
in class Binding<Set<T>>
t
- to inject members on. May be null
.Copyright © 2017 Square, Inc.. All rights reserved.