com.google.inject
Interface Binding<T>

All Known Subinterfaces:
ClassBinding<T>, ConstantBinding<T>, InstanceBinding<T>, LinkedBinding<T>, ProviderBinding<T>, ProviderInstanceBinding<T>

public interface Binding<T>

A mapping from a key (type and optional annotation) to a provider of instances of that type. This interface is part of the Injector introspection API and is intended primary for use by tools.


Method Summary
 void accept(BindingVisitor<? super T> visitor)
          Accepts a binding 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.
 Scope getScope()
          Returns the scope applied by this binding.
 Object getSource()
          Returns an arbitrary object containing information about the "place" where this binding was configured.
 

Method Detail

getKey

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


getSource

Object getSource()
Returns an arbitrary object containing information about the "place" where this binding 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.


getProvider

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


getScope

Scope getScope()
Returns the scope applied by this binding.


accept

void accept(BindingVisitor<? super T> visitor)
Accepts a binding visitor. Invokes the visitor method specific to this binding's type.

Parameters:
visitor - to call back on