com.google.inject.spi
Interface BindingTargetVisitor<T,V>

Type Parameters:
V - any type to be returned by the visit method. Use Void with return null if no return type is needed.
All Known Implementing Classes:
DefaultBindingTargetVisitor

public interface BindingTargetVisitor<T,V>

Visits each of the strategies used to find an instance to satisfy an injection.


Method Summary
 V visitConstructor(Constructor<? extends T> constructor, Set<InjectionPoint> injectionPoints)
          Visit a constructor binding.
 V visitConvertedConstant(T value)
          Visit a binding created from converting a bound instance to a new type.
 V visitInstance(T instance, Set<InjectionPoint> injectionPoints)
          Visit a instance binding.
 V visitKey(Key<? extends T> key)
          Visit a linked key binding.
 V visitProvider(Provider<? extends T> provider, Set<InjectionPoint> injectionPoints)
          Visit a provider instance binding.
 V visitProviderBinding(Key<?> provided)
          Visit a binding to a Provider that delegates to the binding for the provided type.
 V visitProviderKey(Key<? extends Provider<? extends T>> providerKey)
          Visit a provider key binding.
 V visitUntargetted()
          Visit an untargetted binding.
 

Method Detail

visitInstance

V visitInstance(T instance,
                Set<InjectionPoint> injectionPoints)
Visit a instance binding. The same instance is returned for every injection. This target is found in both module and injector bindings.

Parameters:
instance - the user-supplied value
injectionPoints - the field and method injection points of the instance, injected at injector-creation time only.

visitProvider

V visitProvider(Provider<? extends T> provider,
                Set<InjectionPoint> injectionPoints)
Visit a provider instance binding. The provider's get method is invoked to resolve injections. This target is found in both module and injector bindings.

Parameters:
provider - the user-supplied, unscoped provider
injectionPoints - the field and method injection points of the provider, injected at injector-creation time only.

visitProviderKey

V visitProviderKey(Key<? extends Provider<? extends T>> providerKey)
Visit a provider key binding. To resolve injections, the provider injection is first resolved, then that provider's get method is invoked. This target is found in both module and injector bindings.

Parameters:
providerKey - the key used to resolve the provider's binding. That binding can be retrieved from an injector using Injector.getBinding(providerKey)

visitKey

V visitKey(Key<? extends T> key)
Visit a linked key binding. The other key's binding is used to resolve injections. This target is found in both module and injector bindings.

Parameters:
key - the linked key used to resolve injections. That binding can be retrieved from an injector using Injector.getBinding(key)

visitUntargetted

V visitUntargetted()
Visit an untargetted binding. This target is found only on module bindings. It indicates that the injector should use its implicit binding strategies to resolve injections.


visitConstructor

V visitConstructor(Constructor<? extends T> constructor,
                   Set<InjectionPoint> injectionPoints)
Visit a constructor binding. To resolve injections, an instance is instantiated by invoking constructor. This target is found only on injector bindings.

Parameters:
constructor - the annotated or default constructor that is invoked for creating values
injectionPoints - the constructor, field and method injection points to create and populate a new instance. The set contains exactly one constructor injection point.

visitConvertedConstant

V visitConvertedConstant(T value)
Visit a binding created from converting a bound instance to a new type. The source binding has the same binding annotation but a different type. This target is found only on injector bindings.

Parameters:
value - the converted value

visitProviderBinding

V visitProviderBinding(Key<?> provided)
Visit a binding to a Provider that delegates to the binding for the provided type. This target is found only on injector bindings.

Parameters:
provided - the key whose binding is used to provide instances. That binding can be retrieved from an injector using Injector.getBinding(provided)