Package com.google.inject.internal
Class InjectorJitBindingData
java.lang.Object
com.google.inject.internal.InjectorJitBindingData
A container for most just-in-time (JIT) binding data corresponding to an Injector. It
includes @Inject constructor bindings. It does not include
MembersInjectorStore
or ProvisionListenerCallbackStore
, which are still stored in InjectorImpl
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final WeakKeySet
Cache of Keys that we were unable to create JIT bindings for, so we don't keep trying.private final Map<Key<?>,
BindingImpl<?>> Just-in-time binding cache.private final Object
This lock is needed for threadsafe InjectorJitBindingData accesses.private final Optional<InjectorJitBindingData>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
addFailedJitBinding
(Key<?> key) (package private) void
banKey
(Key<?> key, InjectorBindingData injectorBindingData, Object source) Forbids the corresponding injector and its ancestors from creating a binding tokey
.(package private) void
banKeyInParent
(Key<?> key, InjectorBindingData injectorBindingData, Object source) Similar tobanKey(Key, InjectorBindingData, Object)
but we only begin banning the binding at the parent level.(package private) BindingImpl<?>
getJitBinding
(Key<?> key) (package private) Map<Key<?>,
BindingImpl<?>> getSourcesForBannedKey
(Key<?> key) Returns the source of a banned key.(package private) boolean
isBannedKey
(Key<?> key) Returns true ifkey
is forbidden from being bound in the injector corresponding to this data object.(package private) boolean
isFailedJitBinding
(Key<?> key) (package private) Object
lock()
(package private) void
putJitBinding
(Key<?> key, BindingImpl<?> binding) (package private) void
removeJitBinding
(Key<?> key)
-
Field Details
-
jitBindings
Just-in-time binding cache. Guarded bylock
. -
failedJitBindings
Cache of Keys that we were unable to create JIT bindings for, so we don't keep trying. Guarded bylock
. -
bannedKeys
-
parent
-
lock
This lock is needed for threadsafe InjectorJitBindingData accesses. It corresponds to this InjectorJitBindingData's highest ancestor.
-
-
Constructor Details
-
InjectorJitBindingData
InjectorJitBindingData(Optional<InjectorJitBindingData> parent)
-
-
Method Details
-
getJitBindings
Map<Key<?>,BindingImpl<?>> getJitBindings() -
getJitBinding
-
putJitBinding
-
removeJitBinding
-
isFailedJitBinding
-
addFailedJitBinding
-
banKey
Forbids the corresponding injector and its ancestors from creating a binding tokey
. Child injectors ban their bound keys on their parent injectors to prevent just-in-time bindings on the parent injector that would conflict, and pass along their InjectorBindingData to control the banned key's lifetime. -
banKeyInParent
Similar tobanKey(Key, InjectorBindingData, Object)
but we only begin banning the binding at the parent level. This is used to prevent JIT bindings in the parent injector from overriding explicit bindings declared in a child injector. -
isBannedKey
Returns true ifkey
is forbidden from being bound in the injector corresponding to this data object. This indicates that one of the injector's children has bound the key. -
getSourcesForBannedKey
Returns the source of a banned key. -
lock
Object lock()
-