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 Object
implements InternalFactory<T>, Provider<T>, HasDependencies
A base factory implementation. Any Factories that delegate to other bindings should use the
CyclicFactory
subclass, but trivial factories can use this one.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InternalProviderInstanceBindingImpl.InitializationTiming
(package private) ProvisionListenerStackCallback<T>
private Object
-
Constructor Summary
ConstructorsConstructorDescriptionFactory
(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
doProvision
(InternalContext context, Dependency<?> dependency) Creates an object to be injected.final T
get()
Provides an instance ofT
.get
(InternalContext context, Dependency<?> dependency, boolean linked) Creates an object to be injected.(package private) final Object
The binding source.(package private) abstract void
initialize
(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 Details
-
initializationTiming
-
source
-
delegateProvider
-
provisionCallback
ProvisionListenerStackCallback<T> provisionCallback
-
-
Constructor Details
-
Factory
Factory(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming)
-
-
Method Details
-
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
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
Description copied from interface:Provider
Provides an instance ofT
. -
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
-
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
-