Package com.google.inject.internal
Class RealOptionalBinder.RealDirectTypeProvider<T>
- java.lang.Object
-
- com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory<P>
-
- 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
Fields Modifier and Type Field Description private InternalFactory<? extends T>
targetFactory
private Key<? extends T>
targetKey
-
Fields inherited from class com.google.inject.internal.RealOptionalBinder.RealOptionalBinderProviderWithDependencies
bindingSelection
-
Fields inherited from class com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory
provisionCallback
-
-
Constructor Summary
Constructors Constructor Description RealDirectTypeProvider(RealOptionalBinder.BindingSelection<T> bindingSelection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
doInitialize()
Initialize the factory.protected T
doProvision(InternalContext context, Dependency<?> dependency)
Creates an object to be injected.java.util.Set<Dependency<?>>
getDependencies()
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 Detail
-
targetFactory
private InternalFactory<? extends T> targetFactory
-
-
Constructor Detail
-
RealDirectTypeProvider
RealDirectTypeProvider(RealOptionalBinder.BindingSelection<T> bindingSelection)
-
-
Method Detail
-
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
public java.util.Set<Dependency<?>> 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
-
-