Package com.google.inject.internal
Class InheritingState
- java.lang.Object
-
- com.google.inject.internal.InheritingState
-
-
Field Summary
Fields Modifier and Type Field Description private WeakKeySetblacklistedKeysprivate java.util.List<TypeConverterBinding>convertersprivate java.util.Map<Key<?>,Binding<?>>explicitBindingsprivate java.util.Map<Key<?>,Binding<?>>explicitBindingsMutableprivate java.util.Set<InjectionRequest<?>>injectionRequestsprivate java.lang.Objectlockprivate java.util.Set<MembersInjectorLookup<?>>membersInjectorLookupsprivate Stateparentprivate java.util.Set<ProviderLookup<?>>providerLookupsprivate java.util.List<ProvisionListenerBinding>provisionListenerBindingsprivate java.util.List<ModuleAnnotatedMethodScannerBinding>scannerBindingsprivate java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,ScopeBinding>scopesprivate java.util.Set<StaticInjectionRequest>staticInjectionRequestsprivate 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 voidaddConverter(TypeConverterBinding typeConverterBinding)voidaddProvisionListener(ProvisionListenerBinding listenerBinding)voidaddScanner(ModuleAnnotatedMethodScannerBinding scanner)voidaddTypeListener(TypeListenerBinding listenerBinding)voidblacklist(Key<?> key, State state, java.lang.Object source)Forbids the corresponding injector from creating a binding tokey.TypeConverterBindinggetConverter(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()ScopeBindinggetScopeBinding(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()booleanisBlacklisted(Key<?> key)Returns true ifkeyis forbidden from being bound in this injector.java.lang.Objectlock()Returns the shared lock for all injector data.Stateparent()voidputBinding(Key<?> key, BindingImpl<?> binding)voidputInjectionRequest(InjectionRequest<?> injectionRequest)voidputMembersInjectorLookup(MembersInjectorLookup<?> membersInjectorLookup)voidputProviderLookup(ProviderLookup<?> lookup)voidputScopeBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, ScopeBinding scope)voidputStaticInjectionRequest(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:StateGets a binding which was specified explicitly in a module, or null.- Specified by:
getExplicitBindingin interfaceState
-
getExplicitBindingsThisLevel
public java.util.Map<Key<?>,Binding<?>> getExplicitBindingsThisLevel()
Description copied from interface:StateReturns the explicit bindings at this level only.- Specified by:
getExplicitBindingsThisLevelin interfaceState
-
putBinding
public void putBinding(Key<?> key, BindingImpl<?> binding)
- Specified by:
putBindingin interfaceState
-
putProviderLookup
public void putProviderLookup(ProviderLookup<?> lookup)
- Specified by:
putProviderLookupin interfaceState
-
getProviderLookupsThisLevel
public java.util.Set<ProviderLookup<?>> getProviderLookupsThisLevel()
- Specified by:
getProviderLookupsThisLevelin interfaceState
-
putStaticInjectionRequest
public void putStaticInjectionRequest(StaticInjectionRequest staticInjectionRequest)
- Specified by:
putStaticInjectionRequestin interfaceState
-
getStaticInjectionRequestsThisLevel
public java.util.Set<StaticInjectionRequest> getStaticInjectionRequestsThisLevel()
- Specified by:
getStaticInjectionRequestsThisLevelin interfaceState
-
putInjectionRequest
public void putInjectionRequest(InjectionRequest<?> injectionRequest)
- Specified by:
putInjectionRequestin interfaceState
-
getInjectionRequestsThisLevel
public java.util.Set<InjectionRequest<?>> getInjectionRequestsThisLevel()
- Specified by:
getInjectionRequestsThisLevelin interfaceState
-
putMembersInjectorLookup
public void putMembersInjectorLookup(MembersInjectorLookup<?> membersInjectorLookup)
- Specified by:
putMembersInjectorLookupin interfaceState
-
getMembersInjectorLookupsThisLevel
public java.util.Set<MembersInjectorLookup<?>> getMembersInjectorLookupsThisLevel()
- Specified by:
getMembersInjectorLookupsThisLevelin interfaceState
-
getScopeBinding
public ScopeBinding getScopeBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
- Specified by:
getScopeBindingin interfaceState
-
putScopeBinding
public void putScopeBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, ScopeBinding scope)- Specified by:
putScopeBindingin interfaceState
-
getScopeBindingsThisLevel
public java.util.Collection<ScopeBinding> getScopeBindingsThisLevel()
- Specified by:
getScopeBindingsThisLevelin interfaceState
-
getConvertersThisLevel
public java.lang.Iterable<TypeConverterBinding> getConvertersThisLevel()
Description copied from interface:StateReturns all converters at this level only.- Specified by:
getConvertersThisLevelin interfaceState
-
addConverter
public void addConverter(TypeConverterBinding typeConverterBinding)
- Specified by:
addConverterin interfaceState
-
getConverter
public TypeConverterBinding getConverter(java.lang.String stringValue, TypeLiteral<?> type, Errors errors, java.lang.Object source)
Description copied from interface:StateReturns the matching converter fortype, or null if none match.- Specified by:
getConverterin interfaceState
-
addTypeListener
public void addTypeListener(TypeListenerBinding listenerBinding)
- Specified by:
addTypeListenerin interfaceState
-
getTypeListenerBindings
public java.util.List<TypeListenerBinding> getTypeListenerBindings()
- Specified by:
getTypeListenerBindingsin interfaceState
-
getTypeListenerBindingsThisLevel
public java.util.List<TypeListenerBinding> getTypeListenerBindingsThisLevel()
- Specified by:
getTypeListenerBindingsThisLevelin interfaceState
-
addProvisionListener
public void addProvisionListener(ProvisionListenerBinding listenerBinding)
- Specified by:
addProvisionListenerin interfaceState
-
getProvisionListenerBindings
public java.util.List<ProvisionListenerBinding> getProvisionListenerBindings()
- Specified by:
getProvisionListenerBindingsin interfaceState
-
getProvisionListenerBindingsThisLevel
public java.util.List<ProvisionListenerBinding> getProvisionListenerBindingsThisLevel()
- Specified by:
getProvisionListenerBindingsThisLevelin interfaceState
-
addScanner
public void addScanner(ModuleAnnotatedMethodScannerBinding scanner)
- Specified by:
addScannerin interfaceState
-
getScannerBindings
public java.util.List<ModuleAnnotatedMethodScannerBinding> getScannerBindings()
- Specified by:
getScannerBindingsin interfaceState
-
getScannerBindingsThisLevel
public java.util.List<ModuleAnnotatedMethodScannerBinding> getScannerBindingsThisLevel()
- Specified by:
getScannerBindingsThisLevelin interfaceState
-
blacklist
public void blacklist(Key<?> key, State state, java.lang.Object source)
Description copied from interface:StateForbids 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:StateReturns true ifkeyis forbidden from being bound in this injector. This indicates that one of this injector's descendent's has bound the key.- Specified by:
isBlacklistedin interfaceState
-
getSourcesForBlacklistedKey
public java.util.Set<java.lang.Object> getSourcesForBlacklistedKey(Key<?> key)
Description copied from interface:StateReturns the source of a blacklisted key.- Specified by:
getSourcesForBlacklistedKeyin interfaceState
-
lock
public java.lang.Object lock()
Description copied from interface:StateReturns 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).
-
-