org.elasticsearch.common.inject
Interface Binding<T>

Type Parameters:
T - the bound type. The injected is always assignable to this type.
All Superinterfaces:
Element
All Known Subinterfaces:
ConstructorBinding<T>, ConvertedConstantBinding<T>, ExposedBinding<T>, InstanceBinding<T>, LinkedKeyBinding<T>, ProviderBinding<T>, ProviderInstanceBinding<T>, ProviderKeyBinding<T>, UntargettedBinding<T>
All Known Implementing Classes:
BindingImpl, ExposedBindingImpl, InstanceBindingImpl, LinkedBindingImpl, LinkedProviderBindingImpl, ProviderInstanceBindingImpl, UntargettedBindingImpl

public interface Binding<T>
extends Element

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:

They exist on both modules and on injectors, and their behaviour is different for each:

Author:
crazybob@google.com (Bob Lee), jessewilson@google.com (Jesse Wilson)

Method Summary
<V> V
acceptScopingVisitor(BindingScopingVisitor<V> visitor)
          Accepts a scoping visitor.
<V> V
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

getKey

Key<T> getKey()
Returns the key for this binding.


getProvider

Provider<T> getProvider()
Returns the scoped provider guice uses to fulfill requests for this binding.

Throws:
UnsupportedOperationException - when invoked on a Binding created via Elements.getElements(org.elasticsearch.common.inject.Module...). This method is only supported on Bindings returned from an injector.

acceptTargetVisitor

<V> V acceptTargetVisitor(BindingTargetVisitor<? super T,V> visitor)
Accepts a target visitor. Invokes the visitor method specific to this binding's target.

Parameters:
visitor - to call back on
Since:
2.0

acceptScopingVisitor

<V> V acceptScopingVisitor(BindingScopingVisitor<V> visitor)
Accepts a scoping visitor. Invokes the visitor method specific to this binding's scoping.

Parameters:
visitor - to call back on
Since:
2.0


Copyright © 2009-2012. All Rights Reserved.