Class ExtendedScopeResolver

  • All Implemented Interfaces:
    ScopeResolver

    public class ExtendedScopeResolver
    extends java.lang.Object
    implements ScopeResolver
    Wrapper for ScopeResolver with additional information useful for the internal workings of the injector framework.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExtendedScopeResolver​(ScopeResolver delegate, boolean isPseudoScope, boolean isDependentScope)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T get​(java.lang.Object key, CreationalContext<T> creationalContext)
      Returns an existing instance associated with the given key, or uses the given context to create one.
      java.lang.annotation.Annotation getAnnotation()
      Returns the annotation this resolver handles.
      boolean isActive()
      Returns true when this scope is currently active, otherwise false.
      boolean isDependentScope()
      Returns whether this ScopeResolver represents the dependent pseudo-scope.
      boolean isPseudoScope()
      Returns whether this ScopeResolver represents a pseudo-scope.
      void remove​(java.lang.Object key)
      Removes the given key from this scope resolver.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExtendedScopeResolver

        public ExtendedScopeResolver​(ScopeResolver delegate,
                                     boolean isPseudoScope,
                                     boolean isDependentScope)
        Constructs a new instance.
        Parameters:
        delegate - a delegate ScopeResolver, cannot be null
        isPseudoScope - whether the delegate represents a pseudo-scope
        isDependentScope - whether the delegate represents the dependent scope
    • Method Detail

      • isPseudoScope

        public boolean isPseudoScope()
        Returns whether this ScopeResolver represents a pseudo-scope.
        Returns:
        true if it represents a pseudo-scope, otherwise false
      • isDependentScope

        public boolean isDependentScope()
        Returns whether this ScopeResolver represents the dependent pseudo-scope.
        Returns:
        true if it represents the dependent pseudo-scope, otherwise false
      • getAnnotation

        public java.lang.annotation.Annotation getAnnotation()
        Description copied from interface: ScopeResolver
        Returns the annotation this resolver handles. Returns null when the handler handles unscoped injectables.
        Specified by:
        getAnnotation in interface ScopeResolver
        Returns:
        the annotation this resolver handles, never null
      • isActive

        public boolean isActive()
        Description copied from interface: ScopeResolver
        Returns true when this scope is currently active, otherwise false.
        Specified by:
        isActive in interface ScopeResolver
        Returns:
        true when this scope is currently active, otherwise false
      • get

        public <T> T get​(java.lang.Object key,
                         CreationalContext<T> creationalContext)
                  throws ScopeNotActiveException,
                         java.lang.Exception
        Description copied from interface: ScopeResolver
        Returns an existing instance associated with the given key, or uses the given context to create one.
        Specified by:
        get in interface ScopeResolver
        Type Parameters:
        T - the type of the instances provided by the CreationalContext
        Parameters:
        key - an object suitable as a key for use in a map, cannot be null
        creationalContext - an CreationalContext, cannot be null
        Returns:
        an instance of the given type, never null
        Throws:
        ScopeNotActiveException - when there is no scope active
        java.lang.Exception - when the object factory throws an exception
      • remove

        public void remove​(java.lang.Object key)
        Description copied from interface: ScopeResolver
        Removes the given key from this scope resolver.
        Specified by:
        remove in interface ScopeResolver
        Parameters:
        key - an object suitable as a key for use in a map, cannot be null