|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the bound type. The injected is always assignable to this type.public interface Binding<T>
A mapping from a key (type and optional annotation) to the strategy for getting instances of the type. This interface is part of the introspection API and is intended primarily for use by tools.
Bindings are created in several ways:
bind()
and bindConstant()
statements:
bind(Service.class).annotatedWith(Red.class).to(ServiceImpl.class); bindConstant().annotatedWith(ServerHost.class).to(args[0]);
pointer
annotations
or by using its annotated
or
default constructor.providers
, by delegating to the binding for the provided type.They exist on both modules and on injectors, and their behaviour is different for each:
Method Summary | ||
---|---|---|
|
acceptScopingVisitor(BindingScopingVisitor<V> visitor)
Accepts a scoping visitor. |
|
|
acceptTargetVisitor(BindingTargetVisitor<? super T,V> visitor)
Accepts a target visitor. |
|
Key<T> |
getKey()
Returns the key for this binding. |
|
Provider<T> |
getProvider()
Returns the scoped provider guice uses to fulfill requests for this binding. |
Methods inherited from interface org.elasticsearch.common.inject.spi.Element |
---|
acceptVisitor, applyTo, getSource |
Method Detail |
---|
Key<T> getKey()
Provider<T> getProvider()
java.lang.UnsupportedOperationException
- when invoked on a Binding
created via Elements.getElements(org.elasticsearch.common.inject.Module...)
. This
method is only supported on Binding
s returned from an injector.<V> V acceptTargetVisitor(BindingTargetVisitor<? super T,V> visitor)
visitor
- to call back on<V> V acceptScopingVisitor(BindingScopingVisitor<V> visitor)
visitor
- to call back on
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |