org.elasticsearch.common.inject.internal
Class BindingImpl<T>

java.lang.Object
  extended by org.elasticsearch.common.inject.internal.BindingImpl<T>
All Implemented Interfaces:
Binding<T>, Element
Direct Known Subclasses:
ExposedBindingImpl, InstanceBindingImpl, LinkedBindingImpl, LinkedProviderBindingImpl, ProviderInstanceBindingImpl, UntargettedBindingImpl

public abstract class BindingImpl<T>
extends Object
implements Binding<T>

Author:
crazybob@google.com (Bob Lee)

Constructor Summary
  BindingImpl(Injector injector, Key<T> key, Object source, InternalFactory<? extends T> internalFactory, Scoping scoping)
           
protected BindingImpl(Object source, Key<T> key, Scoping scoping)
           
 
Method Summary
<V> V
acceptScopingVisitor(BindingScopingVisitor<V> visitor)
          Accepts a scoping visitor.
<V> V
acceptVisitor(ElementVisitor<V> visitor)
          Accepts an element visitor.
 Injector getInjector()
           
 InternalFactory<? extends T> getInternalFactory()
           
 Key<T> getKey()
          Returns the key for this binding.
 Provider<T> getProvider()
          Returns the scoped provider guice uses to fulfill requests for this binding.
 Scoping getScoping()
           
 Object getSource()
          Returns an arbitrary object containing information about the "place" where this element was configured.
 boolean isConstant()
          Is this a constant binding? This returns true for constant bindings as well as toInstance() bindings.
 String toString()
           
protected  BindingImpl<T> withKey(Key<T> key)
           
protected  BindingImpl<T> withScoping(Scoping scoping)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.elasticsearch.common.inject.Binding
acceptTargetVisitor
 
Methods inherited from interface org.elasticsearch.common.inject.spi.Element
applyTo
 

Constructor Detail

BindingImpl

public BindingImpl(Injector injector,
                   Key<T> key,
                   Object source,
                   InternalFactory<? extends T> internalFactory,
                   Scoping scoping)

BindingImpl

protected BindingImpl(Object source,
                      Key<T> key,
                      Scoping scoping)
Method Detail

getKey

public Key<T> getKey()
Description copied from interface: Binding
Returns the key for this binding.

Specified by:
getKey in interface Binding<T>

getSource

public Object getSource()
Description copied from interface: Element
Returns an arbitrary object containing information about the "place" where this element was configured. Used by Guice in the production of descriptive error messages.

Tools might specially handle types they know about; StackTraceElement is a good example. Tools should simply call toString() on the source object if the type is unfamiliar.

Specified by:
getSource in interface Element

getProvider

public Provider<T> getProvider()
Description copied from interface: Binding
Returns the scoped provider guice uses to fulfill requests for this binding.

Specified by:
getProvider in interface Binding<T>

getInternalFactory

public InternalFactory<? extends T> getInternalFactory()

getScoping

public Scoping getScoping()

isConstant

public boolean isConstant()
Is this a constant binding? This returns true for constant bindings as well as toInstance() bindings.


acceptVisitor

public <V> V acceptVisitor(ElementVisitor<V> visitor)
Description copied from interface: Element
Accepts an element visitor. Invokes the visitor method specific to this element's type.

Specified by:
acceptVisitor in interface Element
Parameters:
visitor - to call back on

acceptScopingVisitor

public <V> V acceptScopingVisitor(BindingScopingVisitor<V> visitor)
Description copied from interface: Binding
Accepts a scoping visitor. Invokes the visitor method specific to this binding's scoping.

Specified by:
acceptScopingVisitor in interface Binding<T>
Parameters:
visitor - to call back on

withScoping

protected BindingImpl<T> withScoping(Scoping scoping)

withKey

protected BindingImpl<T> withKey(Key<T> key)

toString

public String toString()
Overrides:
toString in class Object

getInjector

public Injector getInjector()


Copyright © 2009-2012. All Rights Reserved.