Class InjectorJitBindingData

java.lang.Object
com.google.inject.internal.InjectorJitBindingData

final class InjectorJitBindingData extends Object
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 Details

    • jitBindings

      private final Map<Key<?>,BindingImpl<?>> jitBindings
      Just-in-time binding cache. Guarded by lock.
    • failedJitBindings

      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.
    • bannedKeys

      private final WeakKeySet bannedKeys
    • parent

      private final Optional<InjectorJitBindingData> parent
    • lock

      private final Object lock
      This lock is needed for threadsafe InjectorJitBindingData accesses. It corresponds to this InjectorJitBindingData's highest ancestor.
  • Constructor Details

  • Method Details

    • getJitBindings

      Map<Key<?>,BindingImpl<?>> getJitBindings()
    • getJitBinding

      BindingImpl<?> getJitBinding(Key<?> key)
    • putJitBinding

      void putJitBinding(Key<?> key, BindingImpl<?> binding)
    • removeJitBinding

      void removeJitBinding(Key<?> key)
    • isFailedJitBinding

      boolean isFailedJitBinding(Key<?> key)
    • addFailedJitBinding

      void addFailedJitBinding(Key<?> key)
    • banKey

      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.
    • banKeyInParent

      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.
    • isBannedKey

      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.
    • getSourcesForBannedKey

      Set<Object> getSourcesForBannedKey(Key<?> key)
      Returns the source of a banned key.
    • lock

      Object lock()