Top Fields Constructors Methods
com.google.inject.internal

public abstract Class BindingImpl<T>

extends Object
implements Binding<T>
Class Inheritance
All Implemented Interfaces
com.google.inject.Binding, com.google.inject.spi.Element
Known Direct Subclasses
com.google.inject.internal.ConstructorBindingImpl, com.google.inject.internal.LinkedBindingImpl, com.google.inject.internal.LinkedProviderBindingImpl, com.google.inject.internal.ProviderInstanceBindingImpl, com.google.inject.internal.UntargettedBindingImpl, com.google.inject.internal.ExposedBindingImpl, com.google.inject.internal.InjectorImpl.SyntheticProviderBindingImpl, com.google.inject.internal.InjectorImpl.ConvertedConstantBindingImpl, com.google.inject.internal.InstanceBindingImpl
Imports
com.google.common.base.MoreObjects, com.google.inject.Binding, .Key, .Provider, com.google.inject.spi.BindingScopingVisitor, .ElementVisitor, .InstanceBinding

Author
[email protected] (Bob Lee)

Field Summary

Modifier and TypeField and Description
private final InjectorImpl
private final InternalFactory<? extends T>
private final Key<T>
private volatile Provider<T>
private final Scoping
private final Object

Constructor Summary

AccessConstructor and Description
pack-priv
BindingImpl(InjectorImpl injector, Key<T> key, Object source, InternalFactory<? extends T> internalFactory, Scoping scoping)

pack-priv
BindingImpl(Object source, Key<T> key, Scoping scoping)

Method Summary

Modifier and TypeMethod and Description
public <V> V
acceptScopingVisitor(BindingScopingVisitor<V>
to call back on
visitor
)

Implements com.google.inject.Binding.acceptScopingVisitor.

Accepts a scoping visitor.
public <V> V
acceptVisitor(ElementVisitor<V>
to call back on
visitor
)

Implements com.google.inject.spi.Element.acceptVisitor.

Accepts an element visitor.
public InjectorImpl
public InternalFactory<? extends T>
public Key<T>
getKey()

Implements com.google.inject.Binding.getKey.

Returns the key for this binding.
public Provider<T>
getProvider()

Implements com.google.inject.Binding.getProvider.

Returns the scoped provider guice uses to fulfill requests for this binding.
public Scoping
public Object
getSource()

Implements com.google.inject.spi.Element.getSource.

Returns an arbitrary object containing information about the "place" where this element was configured.
public boolean
isConstant()

Is this a constant binding?

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
protected BindingImpl<T>
withKey(Key<T> key)

protected BindingImpl<T>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

injectorback to summary
private final InjectorImpl injector
internalFactoryback to summary
private final InternalFactory<? extends T> internalFactory
keyback to summary
private final Key<T> key
providerback to summary
private volatile Provider<T> provider
scopingback to summary
private final Scoping scoping
sourceback to summary
private final Object source

Constructor Detail

BindingImplback to summary
pack-priv BindingImpl(InjectorImpl injector, Key<T> key, Object source, InternalFactory<? extends T> internalFactory, Scoping scoping)
BindingImplback to summary
pack-priv BindingImpl(Object source, Key<T> key, Scoping scoping)

Method Detail

acceptScopingVisitorback to summary
public <V> V acceptScopingVisitor(BindingScopingVisitor<V> visitor)

Implements com.google.inject.Binding.acceptScopingVisitor.

Doc from com.google.inject.Binding.acceptScopingVisitor.

Accepts a scoping visitor. Invokes the visitor method specific to this binding's scoping.

Parameters
visitor:BindingScopingVisitor<V>

to call back on

Annotations
@Override
acceptVisitorback to summary
public <V> V acceptVisitor(ElementVisitor<V> visitor)

Implements com.google.inject.spi.Element.acceptVisitor.

Doc from com.google.inject.spi.Element.acceptVisitor.

Accepts an element visitor. Invokes the visitor method specific to this element's type.

Parameters
visitor:ElementVisitor<V>

to call back on

Annotations
@Override
getInjectorback to summary
public InjectorImpl getInjector()
getInternalFactoryback to summary
public InternalFactory<? extends T> getInternalFactory()
getKeyback to summary
public Key<T> getKey()

Implements com.google.inject.Binding.getKey.

Doc from com.google.inject.Binding.getKey.

Returns the key for this binding.

Annotations
@Override
getProviderback to summary
public Provider<T> getProvider()

Implements com.google.inject.Binding.getProvider.

Doc from com.google.inject.Binding.getProvider.

Returns the scoped provider guice uses to fulfill requests for this binding.

Annotations
@Override
getScopingback to summary
public Scoping getScoping()
getSourceback to summary
public Object getSource()

Implements com.google.inject.spi.Element.getSource.

Doc from com.google.inject.spi.Element.getSource.

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.

Annotations
@Override
isConstantback to summary
public boolean isConstant()

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

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
withKeyback to summary
protected BindingImpl<T> withKey(Key<T> key)
withScopingback to summary
protected BindingImpl<T> withScoping(Scoping scoping)