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 InjectorImpl
injector
private InternalFactory<? extends javax.inject.Provider<? extends T>>
providerFactory
(package private) Key<? extends javax.inject.Provider<? extends T>>
providerKey
private 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 T
get(InternalContext context, Dependency<?> dependency, boolean linked)
Creates an object to be injected.void
notify(Errors errors)
Notifies that creation should happen.protected T
provision(javax.inject.Provider<? extends T> provider, Dependency<?> dependency, ConstructionContext<T> constructionContext)
Provisions a new instance.java.lang.String
toString()
-
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:CreationListener
Notifies that creation should happen.- Specified by:
notify
in interfaceCreationListener
-
get
public T get(InternalContext context, Dependency<?> dependency, boolean linked) throws InternalProvisionException
Description copied from interface:InternalFactory
Creates an object to be injected.- Specified by:
get
in 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:ProviderInternalFactory
Provisions a new instance. Subclasses should override this to catch exceptions & rethrow as ErrorsExceptions.- Overrides:
provision
in classProviderInternalFactory<T>
- Throws:
InternalProvisionException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-