Package com.google.inject.internal
Class BoundProviderFactory<T>
- java.lang.Object
-
- com.google.inject.internal.ProviderInternalFactory<T>
-
- com.google.inject.internal.BoundProviderFactory<T>
-
- All Implemented Interfaces:
CreationListener,InternalFactory<T>
final class BoundProviderFactory<T> extends ProviderInternalFactory<T> implements CreationListener
Delegates to a custom factory which is also bound in the injector.
-
-
Field Summary
Fields Modifier and Type Field Description private InjectorImplinjectorprivate InternalFactory<? extends javax.inject.Provider<? extends T>>providerFactory(package private) Key<? extends javax.inject.Provider<? extends T>>providerKeyprivate ProvisionListenerStackCallback<T>provisionCallback-
Fields inherited from class com.google.inject.internal.ProviderInternalFactory
source
-
-
Constructor Summary
Constructors Constructor Description BoundProviderFactory(InjectorImpl injector, Key<? extends javax.inject.Provider<? extends T>> providerKey, java.lang.Object source, ProvisionListenerStackCallback<T> provisionCallback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget(InternalContext context, Dependency<?> dependency, boolean linked)Creates an object to be injected.voidnotify(Errors errors)Notifies that creation should happen.protected Tprovision(javax.inject.Provider<? extends T> provider, Dependency<?> dependency, ConstructionContext<T> constructionContext)Provisions a new instance.java.lang.StringtoString()-
Methods inherited from class com.google.inject.internal.ProviderInternalFactory
circularGet
-
-
-
-
Field Detail
-
provisionCallback
private final ProvisionListenerStackCallback<T> provisionCallback
-
injector
private final InjectorImpl injector
-
providerFactory
private InternalFactory<? extends javax.inject.Provider<? extends T>> providerFactory
-
-
Constructor Detail
-
BoundProviderFactory
BoundProviderFactory(InjectorImpl injector, Key<? extends javax.inject.Provider<? extends T>> providerKey, java.lang.Object source, ProvisionListenerStackCallback<T> provisionCallback)
-
-
Method Detail
-
notify
public void notify(Errors errors)
Description copied from interface:CreationListenerNotifies that creation should happen.- Specified by:
notifyin interfaceCreationListener
-
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
-
provision
protected T provision(javax.inject.Provider<? extends T> provider, Dependency<?> dependency, ConstructionContext<T> constructionContext) throws InternalProvisionException
Description copied from class:ProviderInternalFactoryProvisions a new instance. Subclasses should override this to catch exceptions & rethrow as ErrorsExceptions.- Overrides:
provisionin classProviderInternalFactory<T>- Throws:
InternalProvisionException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-