Package com.google.inject.internal
Class InternalProviderInstanceBindingImpl.Factory<T>
- java.lang.Object
-
- com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory<T>
-
- All Implemented Interfaces:
InternalFactory<T>,Provider<T>,HasDependencies,javax.inject.Provider<T>
- Direct Known Subclasses:
InternalProviderInstanceBindingImpl.CyclicFactory,RealMapBinder.ProviderMapEntry,RealMapBinder.RealMapBinderProviderWithDependencies,RealMapBinder.RealMultimapBinderProviderWithDependencies,RealMultibinder.RealMultibinderCollectionOfProvidersProvider,RealMultibinder.RealMultibinderProvider,RealOptionalBinder.RealOptionalBinderProviderWithDependencies
- Enclosing class:
- InternalProviderInstanceBindingImpl<T>
abstract static class InternalProviderInstanceBindingImpl.Factory<T> extends java.lang.Object implements InternalFactory<T>, Provider<T>, HasDependencies
A base factory implementation. Any Factories that delegate to other bindings should use theCyclicFactorysubclass, but trivial factories can use this one.
-
-
Field Summary
Fields Modifier and Type Field Description private Provider<T>delegateProviderprivate InternalProviderInstanceBindingImpl.InitializationTiminginitializationTiming(package private) ProvisionListenerStackCallback<T>provisionCallbackprivate java.lang.Objectsource
-
Constructor Summary
Constructors Constructor Description Factory(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TdoProvision(InternalContext context, Dependency<?> dependency)Creates an object to be injected.Tget()Provides an instance ofT.Tget(InternalContext context, Dependency<?> dependency, boolean linked)Creates an object to be injected.(package private) java.lang.ObjectgetSource()The binding source.(package private) abstract voidinitialize(InjectorImpl injector, Errors errors)A callback that allows for implementations to fetch dependencies on other bindings.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.inject.spi.HasDependencies
getDependencies
-
-
-
-
Field Detail
-
initializationTiming
private final InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming
-
source
private java.lang.Object source
-
provisionCallback
ProvisionListenerStackCallback<T> provisionCallback
-
-
Constructor Detail
-
Factory
Factory(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming)
-
-
Method Detail
-
getSource
final java.lang.Object getSource()
The binding source.May be useful for augmenting runtime error messages.
Note: this will return {#code null} until
initialize(InjectorImpl, Errors)has already been called.
-
initialize
abstract void initialize(InjectorImpl injector, Errors errors) throws ErrorsException
A callback that allows for implementations to fetch dependencies on other bindings.Will be called exactly once, prior to any call to
doProvision(com.google.inject.internal.InternalContext, com.google.inject.spi.Dependency<?>).- Throws:
ErrorsException
-
get
public T get(InternalContext context, Dependency<?> dependency, boolean linked) throws InternalProvisionException
Description copied from interface:InternalFactoryCreates an object to be injected.- Specified by:
getin interfaceInternalFactory<T>- Parameters:
context- of this injectionlinked- true if getting as a result of a linked binding- Returns:
- instance that was created
- Throws:
InternalProvisionException- if a value cannot be provided
-
doProvision
protected abstract T doProvision(InternalContext context, Dependency<?> dependency) throws InternalProvisionException
Creates an object to be injected.- Returns:
- instance to be injected
- Throws:
InternalProvisionException- if a value cannot be provided
-
-