abstract static class InternalProviderInstanceBindingImpl.Factory<T> extends java.lang.Object implements InternalFactory<T>, Provider<T>, HasDependencies
CyclicFactory
subclass, but trivial factories can use this one.Modifier and Type | Field and Description |
---|---|
private Provider<T> |
delegateProvider |
private InternalProviderInstanceBindingImpl.InitializationTiming |
initializationTiming |
(package private) ProvisionListenerStackCallback<T> |
provisionCallback |
private java.lang.Object |
source |
Constructor and Description |
---|
Factory(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming) |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
doProvision(InternalContext context,
Dependency<?> dependency)
Creates an object to be injected.
|
T |
get()
Provides an instance of
T . |
T |
get(InternalContext context,
Dependency<?> dependency,
boolean linked)
Creates an object to be injected.
|
(package private) java.lang.Object |
getSource()
The binding source.
|
(package private) abstract void |
initialize(InjectorImpl injector,
Errors errors)
A callback that allows for implementations to fetch dependencies on other bindings.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDependencies
private final InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming
private java.lang.Object source
ProvisionListenerStackCallback<T> provisionCallback
Factory(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming)
final java.lang.Object getSource()
May be useful for augmenting runtime error messages.
Note: this will return {#code null} until initialize(InjectorImpl, Errors)
has
already been called.
abstract void initialize(InjectorImpl injector, Errors errors) throws ErrorsException
Will be called exactly once, prior to any call to doProvision(com.google.inject.internal.InternalContext, com.google.inject.spi.Dependency<?>)
.
ErrorsException
public final T get()
Provider
T
.get
in interface javax.inject.Provider<T>
public T get(InternalContext context, Dependency<?> dependency, boolean linked) throws InternalProvisionException
InternalFactory
get
in interface InternalFactory<T>
context
- of this injectionlinked
- true if getting as a result of a linked bindingInternalProvisionException
- if a value cannot be providedprotected abstract T doProvision(InternalContext context, Dependency<?> dependency) throws InternalProvisionException
InternalProvisionException
- if a value cannot be provided