Package com.google.inject.internal
Class InheritingState
- java.lang.Object
-
- com.google.inject.internal.InheritingState
-
-
Field Summary
Fields Modifier and Type Field Description private WeakKeySet
blacklistedKeys
private java.util.List<TypeConverterBinding>
converters
private java.util.Map<Key<?>,Binding<?>>
explicitBindings
private java.util.Map<Key<?>,Binding<?>>
explicitBindingsMutable
private java.util.Set<InjectionRequest<?>>
injectionRequests
private java.lang.Object
lock
private java.util.Set<MembersInjectorLookup<?>>
membersInjectorLookups
private State
parent
private java.util.Set<ProviderLookup<?>>
providerLookups
private java.util.List<ProvisionListenerBinding>
provisionListenerBindings
private java.util.List<ModuleAnnotatedMethodScannerBinding>
scannerBindings
private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,ScopeBinding>
scopes
private java.util.Set<StaticInjectionRequest>
staticInjectionRequests
private java.util.List<TypeListenerBinding>
typeListenerBindings
-
Constructor Summary
Constructors Constructor Description InheritingState(State parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConverter(TypeConverterBinding typeConverterBinding)
void
addProvisionListener(ProvisionListenerBinding listenerBinding)
void
addScanner(ModuleAnnotatedMethodScannerBinding scanner)
void
addTypeListener(TypeListenerBinding listenerBinding)
void
blacklist(Key<?> key, State state, java.lang.Object source)
Forbids the corresponding injector from creating a binding tokey
.TypeConverterBinding
getConverter(java.lang.String stringValue, TypeLiteral<?> type, Errors errors, java.lang.Object source)
Returns the matching converter fortype
, or null if none match.java.lang.Iterable<TypeConverterBinding>
getConvertersThisLevel()
Returns all converters at this level only.<T> BindingImpl<T>
getExplicitBinding(Key<T> key)
Gets a binding which was specified explicitly in a module, or null.java.util.Map<Key<?>,Binding<?>>
getExplicitBindingsThisLevel()
Returns the explicit bindings at this level only.java.util.Set<InjectionRequest<?>>
getInjectionRequestsThisLevel()
java.util.Set<MembersInjectorLookup<?>>
getMembersInjectorLookupsThisLevel()
java.util.Set<ProviderLookup<?>>
getProviderLookupsThisLevel()
java.util.List<ProvisionListenerBinding>
getProvisionListenerBindings()
java.util.List<ProvisionListenerBinding>
getProvisionListenerBindingsThisLevel()
java.util.List<ModuleAnnotatedMethodScannerBinding>
getScannerBindings()
java.util.List<ModuleAnnotatedMethodScannerBinding>
getScannerBindingsThisLevel()
ScopeBinding
getScopeBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
java.util.Collection<ScopeBinding>
getScopeBindingsThisLevel()
java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,Scope>
getScopes()
Returns all the scope bindings at this level and parent levels.java.util.Set<java.lang.Object>
getSourcesForBlacklistedKey(Key<?> key)
Returns the source of a blacklisted key.java.util.Set<StaticInjectionRequest>
getStaticInjectionRequestsThisLevel()
java.util.List<TypeListenerBinding>
getTypeListenerBindings()
java.util.List<TypeListenerBinding>
getTypeListenerBindingsThisLevel()
boolean
isBlacklisted(Key<?> key)
Returns true ifkey
is forbidden from being bound in this injector.java.lang.Object
lock()
Returns the shared lock for all injector data.State
parent()
void
putBinding(Key<?> key, BindingImpl<?> binding)
void
putInjectionRequest(InjectionRequest<?> injectionRequest)
void
putMembersInjectorLookup(MembersInjectorLookup<?> membersInjectorLookup)
void
putProviderLookup(ProviderLookup<?> lookup)
void
putScopeBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, ScopeBinding scope)
void
putStaticInjectionRequest(StaticInjectionRequest staticInjectionRequest)
-
-
-
Field Detail
-
parent
private final State parent
-
scopes
private final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,ScopeBinding> scopes
-
providerLookups
private final java.util.Set<ProviderLookup<?>> providerLookups
-
staticInjectionRequests
private final java.util.Set<StaticInjectionRequest> staticInjectionRequests
-
membersInjectorLookups
private final java.util.Set<MembersInjectorLookup<?>> membersInjectorLookups
-
injectionRequests
private final java.util.Set<InjectionRequest<?>> injectionRequests
-
converters
private final java.util.List<TypeConverterBinding> converters
-
typeListenerBindings
private final java.util.List<TypeListenerBinding> typeListenerBindings
-
provisionListenerBindings
private final java.util.List<ProvisionListenerBinding> provisionListenerBindings
-
scannerBindings
private final java.util.List<ModuleAnnotatedMethodScannerBinding> scannerBindings
-
blacklistedKeys
private final WeakKeySet blacklistedKeys
-
lock
private final java.lang.Object lock
-
-
Constructor Detail
-
InheritingState
InheritingState(State parent)
-
-
Method Detail
-
getExplicitBinding
public <T> BindingImpl<T> getExplicitBinding(Key<T> key)
Description copied from interface:State
Gets a binding which was specified explicitly in a module, or null.- Specified by:
getExplicitBinding
in interfaceState
-
getExplicitBindingsThisLevel
public java.util.Map<Key<?>,Binding<?>> getExplicitBindingsThisLevel()
Description copied from interface:State
Returns the explicit bindings at this level only.- Specified by:
getExplicitBindingsThisLevel
in interfaceState
-
putBinding
public void putBinding(Key<?> key, BindingImpl<?> binding)
- Specified by:
putBinding
in interfaceState
-
putProviderLookup
public void putProviderLookup(ProviderLookup<?> lookup)
- Specified by:
putProviderLookup
in interfaceState
-
getProviderLookupsThisLevel
public java.util.Set<ProviderLookup<?>> getProviderLookupsThisLevel()
- Specified by:
getProviderLookupsThisLevel
in interfaceState
-
putStaticInjectionRequest
public void putStaticInjectionRequest(StaticInjectionRequest staticInjectionRequest)
- Specified by:
putStaticInjectionRequest
in interfaceState
-
getStaticInjectionRequestsThisLevel
public java.util.Set<StaticInjectionRequest> getStaticInjectionRequestsThisLevel()
- Specified by:
getStaticInjectionRequestsThisLevel
in interfaceState
-
putInjectionRequest
public void putInjectionRequest(InjectionRequest<?> injectionRequest)
- Specified by:
putInjectionRequest
in interfaceState
-
getInjectionRequestsThisLevel
public java.util.Set<InjectionRequest<?>> getInjectionRequestsThisLevel()
- Specified by:
getInjectionRequestsThisLevel
in interfaceState
-
putMembersInjectorLookup
public void putMembersInjectorLookup(MembersInjectorLookup<?> membersInjectorLookup)
- Specified by:
putMembersInjectorLookup
in interfaceState
-
getMembersInjectorLookupsThisLevel
public java.util.Set<MembersInjectorLookup<?>> getMembersInjectorLookupsThisLevel()
- Specified by:
getMembersInjectorLookupsThisLevel
in interfaceState
-
getScopeBinding
public ScopeBinding getScopeBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
- Specified by:
getScopeBinding
in interfaceState
-
putScopeBinding
public void putScopeBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, ScopeBinding scope)
- Specified by:
putScopeBinding
in interfaceState
-
getScopeBindingsThisLevel
public java.util.Collection<ScopeBinding> getScopeBindingsThisLevel()
- Specified by:
getScopeBindingsThisLevel
in interfaceState
-
getConvertersThisLevel
public java.lang.Iterable<TypeConverterBinding> getConvertersThisLevel()
Description copied from interface:State
Returns all converters at this level only.- Specified by:
getConvertersThisLevel
in interfaceState
-
addConverter
public void addConverter(TypeConverterBinding typeConverterBinding)
- Specified by:
addConverter
in interfaceState
-
getConverter
public TypeConverterBinding getConverter(java.lang.String stringValue, TypeLiteral<?> type, Errors errors, java.lang.Object source)
Description copied from interface:State
Returns the matching converter fortype
, or null if none match.- Specified by:
getConverter
in interfaceState
-
addTypeListener
public void addTypeListener(TypeListenerBinding listenerBinding)
- Specified by:
addTypeListener
in interfaceState
-
getTypeListenerBindings
public java.util.List<TypeListenerBinding> getTypeListenerBindings()
- Specified by:
getTypeListenerBindings
in interfaceState
-
getTypeListenerBindingsThisLevel
public java.util.List<TypeListenerBinding> getTypeListenerBindingsThisLevel()
- Specified by:
getTypeListenerBindingsThisLevel
in interfaceState
-
addProvisionListener
public void addProvisionListener(ProvisionListenerBinding listenerBinding)
- Specified by:
addProvisionListener
in interfaceState
-
getProvisionListenerBindings
public java.util.List<ProvisionListenerBinding> getProvisionListenerBindings()
- Specified by:
getProvisionListenerBindings
in interfaceState
-
getProvisionListenerBindingsThisLevel
public java.util.List<ProvisionListenerBinding> getProvisionListenerBindingsThisLevel()
- Specified by:
getProvisionListenerBindingsThisLevel
in interfaceState
-
addScanner
public void addScanner(ModuleAnnotatedMethodScannerBinding scanner)
- Specified by:
addScanner
in interfaceState
-
getScannerBindings
public java.util.List<ModuleAnnotatedMethodScannerBinding> getScannerBindings()
- Specified by:
getScannerBindings
in interfaceState
-
getScannerBindingsThisLevel
public java.util.List<ModuleAnnotatedMethodScannerBinding> getScannerBindingsThisLevel()
- Specified by:
getScannerBindingsThisLevel
in interfaceState
-
blacklist
public void blacklist(Key<?> key, State state, java.lang.Object source)
Description copied from interface:State
Forbids the corresponding injector from creating a binding tokey
. Child injectors blacklist their bound keys on their parent injectors to prevent just-in-time bindings on the parent injector that would conflict and pass along their state to control the lifetimes.
-
isBlacklisted
public boolean isBlacklisted(Key<?> key)
Description copied from interface:State
Returns true ifkey
is forbidden from being bound in this injector. This indicates that one of this injector's descendent's has bound the key.- Specified by:
isBlacklisted
in interfaceState
-
getSourcesForBlacklistedKey
public java.util.Set<java.lang.Object> getSourcesForBlacklistedKey(Key<?> key)
Description copied from interface:State
Returns the source of a blacklisted key.- Specified by:
getSourcesForBlacklistedKey
in interfaceState
-
lock
public java.lang.Object lock()
Description copied from interface:State
Returns the shared lock for all injector data. This is a low-granularity, high-contention lock to be used when reading mutable data (ie. just-in-time bindings, and binding blacklists).
-
-