Top Description Fields Constructors Methods
com.google.inject.internal

pack-priv final Class InjectorJitBindingData

extends Object
Class Inheritance
Imports
com.google.common.collect.Maps, .Sets, com.google.inject.Key, java.util.Collections, .Map, .Optional, .Set

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

Modifier and TypeField and Description
private final WeakKeySet
private final Set<Key<?>>
failedJitBindings

Cache of Keys that we were unable to create JIT bindings for, so we don't keep trying.

private final Map<Key<?>, BindingImpl<?>>
jitBindings

Just-in-time binding cache.

private final Object
lock

This lock is needed for threadsafe InjectorJitBindingData accesses.

private final Optional<InjectorJitBindingData>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
banKey(Key<?> key, InjectorBindingData injectorBindingData, Object source)

Forbids the corresponding injector and its ancestors from creating a binding to key.

pack-priv void
banKeyInParent(Key<?> key, InjectorBindingData injectorBindingData, Object source)

Similar to banKey(Key, InjectorBindingData, Object) but we only begin banning the binding at the parent level.

pack-priv BindingImpl<?>
pack-priv Map<Key<?>, BindingImpl<?>>
pack-priv Set<Object>
getSourcesForBannedKey(Key<?> key)

Returns the source of a banned key.

pack-priv boolean
isBannedKey(Key<?> key)

Returns true if key is forbidden from being bound in the injector corresponding to this data object.

pack-priv boolean
pack-priv Object
lock()

pack-priv void
putJitBinding(Key<?> key, BindingImpl<?> binding)

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bannedKeysback to summary
private final WeakKeySet bannedKeys
failedJitBindingsback to summary
private final Set<Key<?>> failedJitBindings

Cache of Keys that we were unable to create JIT bindings for, so we don't keep trying. Guarded by lock.

jitBindingsback to summary
private final Map<Key<?>, BindingImpl<?>> jitBindings

Just-in-time binding cache. Guarded by lock.

lockback to summary
private final Object lock

This lock is needed for threadsafe InjectorJitBindingData accesses. It corresponds to this InjectorJitBindingData's highest ancestor.

parentback to summary
private final Optional<InjectorJitBindingData> parent

Constructor Detail

InjectorJitBindingDataback to summary
pack-priv InjectorJitBindingData(Optional<InjectorJitBindingData> parent)

Method Detail

addFailedJitBindingback to summary
pack-priv void addFailedJitBinding(Key<?> key)
banKeyback to summary
pack-priv void banKey(Key<?> key, InjectorBindingData injectorBindingData, Object source)

Forbids the corresponding injector and its ancestors from creating a binding to key. 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.

banKeyInParentback to summary
pack-priv void banKeyInParent(Key<?> key, InjectorBindingData injectorBindingData, Object source)

Similar to banKey(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.

getJitBindingback to summary
pack-priv BindingImpl<?> getJitBinding(Key<?> key)
getJitBindingsback to summary
pack-priv Map<Key<?>, BindingImpl<?>> getJitBindings()
getSourcesForBannedKeyback to summary
pack-priv Set<Object> getSourcesForBannedKey(Key<?> key)

Returns the source of a banned key.

isBannedKeyback to summary
pack-priv boolean isBannedKey(Key<?> key)

Returns true if key 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.

isFailedJitBindingback to summary
pack-priv boolean isFailedJitBinding(Key<?> key)
lockback to summary
pack-priv Object lock()
putJitBindingback to summary
pack-priv void putJitBinding(Key<?> key, BindingImpl<?> binding)
removeJitBindingback to summary
pack-priv void removeJitBinding(Key<?> key)