Top Description Methods
com.google.inject

public Interface Binding<T>

extends Element
Known Direct Subinterfaces
com.google.inject.spi.ConstructorBinding, com.google.inject.spi.ConvertedConstantBinding, com.google.inject.spi.ExposedBinding, com.google.inject.spi.InstanceBinding, com.google.inject.spi.LinkedKeyBinding, com.google.inject.spi.ProviderBinding, com.google.inject.spi.ProviderInstanceBinding, com.google.inject.spi.ProviderKeyBinding, com.google.inject.spi.UntargettedBinding
Known Direct Implementers
com.google.inject.internal.BindingImpl
Type Parameters
<T>
the bound type. The injected is always assignable to this type.
Imports
com.google.inject.spi.BindingScopingVisitor, .BindingTargetVisitor, .Element

A mapping from a Key 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:

Authors
[email protected] (Bob Lee), [email protected] (Jesse Wilson)

Method Summary

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

Accepts a scoping visitor.

public <V> V
acceptTargetVisitor(BindingTargetVisitor<? super T, V>
to call back on
visitor
)

Accepts a target visitor.

public Key<T>
getKey()

Returns the key for this binding.

public Provider<T>
getProvider()

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

Inherited from com.google.inject.spi.Element:
acceptVisitorapplyTogetSource

Method Detail

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

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

Parameters
visitor:BindingScopingVisitor<V>

to call back on

Since
2.0
acceptTargetVisitorback to summary
public <V> V acceptTargetVisitor(BindingTargetVisitor<? super T, V> visitor)

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

Parameters
visitor:BindingTargetVisitor<? super T, V>

to call back on

Since
2.0
getKeyback to summary
public Key<T> getKey()

Returns the key for this binding.

getProviderback to summary
public Provider<T> getProvider()

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

Exceptions
UnsupportedOperationException:
when invoked on a Binding created via com.google.inject.spi.Elements#getElements. This method is only supported on Bindings returned from an injector.