Class InheritingState

  • All Implemented Interfaces:
    State

    final class InheritingState
    extends java.lang.Object
    implements State
    • Field Detail

      • parent

        private final State parent
      • explicitBindingsMutable

        private final java.util.Map<Key<?>,​Binding<?>> explicitBindingsMutable
      • explicitBindings

        private final java.util.Map<Key<?>,​Binding<?>> explicitBindings
      • scopes

        private final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,​ScopeBinding> scopes
      • methodAspects

        private final java.util.List<MethodAspect> methodAspects
      • 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 interface State
      • 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 interface State
      • getScopeBinding

        public ScopeBinding getScopeBinding​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
        Specified by:
        getScopeBinding in interface State
      • putScopeBinding

        public void putScopeBinding​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                    ScopeBinding scope)
        Specified by:
        putScopeBinding in interface State
      • 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 for type, or null if none match.
        Specified by:
        getConverter in interface State
      • 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 to key. 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.
        Specified by:
        blacklist in interface State
      • isBlacklisted

        public boolean isBlacklisted​(Key<?> key)
        Description copied from interface: State
        Returns true if key 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 interface State
      • 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 interface State
      • 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).
        Specified by:
        lock in interface State
      • getScopes

        public java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,​Scope> getScopes()
        Description copied from interface: State
        Returns all the scope bindings at this level and parent levels.
        Specified by:
        getScopes in interface State