Package com.google.inject.internal
Class RealOptionalBinder.RealDirectTypeProvider<T>
java.lang.Object
com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory<T>
com.google.inject.internal.RealOptionalBinder.RealOptionalBinderProviderWithDependencies<T,T>
com.google.inject.internal.RealOptionalBinder.RealDirectTypeProvider<T>
- All Implemented Interfaces:
InternalFactory<T>
,Provider<T>
,HasDependencies
,javax.inject.Provider<T>
- Enclosing class:
RealOptionalBinder<T>
private static final class RealOptionalBinder.RealDirectTypeProvider<T>
extends RealOptionalBinder.RealOptionalBinderProviderWithDependencies<T,T>
Provides the binding for T, conditionally installed by calling setBinding/setDefault.
-
Field Summary
FieldsFields inherited from class com.google.inject.internal.RealOptionalBinder.RealOptionalBinderProviderWithDependencies
bindingSelection
Fields inherited from class com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory
provisionCallback
-
Constructor Summary
ConstructorsConstructorDescriptionRealDirectTypeProvider
(RealOptionalBinder.BindingSelection<T> bindingSelection) -
Method Summary
Modifier and TypeMethodDescription(package private) void
Initialize the factory.protected T
doProvision
(InternalContext context, Dependency<?> dependency) Creates an object to be injected.Set
<Dependency<?>> Returns the known dependencies for this type.Methods inherited from class com.google.inject.internal.RealOptionalBinder.RealOptionalBinderProviderWithDependencies
equals, hashCode, initialize
Methods inherited from class com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory
get, get, getSource
-
Field Details
-
targetKey
-
targetFactory
-
-
Constructor Details
-
RealDirectTypeProvider
RealDirectTypeProvider(RealOptionalBinder.BindingSelection<T> bindingSelection)
-
-
Method Details
-
doInitialize
void doInitialize()Description copied from class:RealOptionalBinder.RealOptionalBinderProviderWithDependencies
Initialize the factory. BindingSelection is guaranteed to be initialized at this point and this will be called prior to any provisioning.- Specified by:
doInitialize
in classRealOptionalBinder.RealOptionalBinderProviderWithDependencies<T,
T>
-
doProvision
protected T doProvision(InternalContext context, Dependency<?> dependency) throws InternalProvisionException Description copied from class:InternalProviderInstanceBindingImpl.Factory
Creates an object to be injected.- Specified by:
doProvision
in classInternalProviderInstanceBindingImpl.Factory<T>
- Returns:
- instance to be injected
- Throws:
InternalProvisionException
- if a value cannot be provided
-
getDependencies
Description copied from interface:HasDependencies
Returns the known dependencies for this type. If this has dependencies whose values are not known statically, a dependency for theInjector
will be included in the returned set.- Returns:
- a possibly empty set
-