Interface ScopeStrategy

  • All Known Implementing Classes:
    SimpleScopeStrategy

    public interface ScopeStrategy
    Defines the strategy for scope handling.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.annotation.Annotation getDefaultAnnotation()
      Returns the annotation that marks the default scope.
      java.lang.annotation.Annotation getDependentAnnotation()
      Returns the annotation that marks the dependent pseudo-scope.
      java.lang.annotation.Annotation getScope​(java.lang.reflect.AnnotatedElement element)
      Returns the scope annotation on the given AnnotatedElement, if any.
      java.lang.annotation.Annotation getSingletonAnnotation()
      Returns the annotation that marks the singleton pseudo-scope.
      boolean isPseudoScope​(java.lang.annotation.Annotation annotation)
      Returns whether the given annotation is a pseudo-scope.
    • Method Detail

      • getDefaultAnnotation

        java.lang.annotation.Annotation getDefaultAnnotation()
        Returns the annotation that marks the default scope. Objects without a scope annotation will get this scope as their scope.
        Returns:
        an annotation, never null
      • getDependentAnnotation

        java.lang.annotation.Annotation getDependentAnnotation()
        Returns the annotation that marks the dependent pseudo-scope.
        Returns:
        an annotation, never null
      • getSingletonAnnotation

        java.lang.annotation.Annotation getSingletonAnnotation()
        Returns the annotation that marks the singleton pseudo-scope.
        Returns:
        an annotation, never null
      • getScope

        java.lang.annotation.Annotation getScope​(java.lang.reflect.AnnotatedElement element)
                                          throws DefinitionException
        Returns the scope annotation on the given AnnotatedElement, if any. It is recommended to return null instead of a default scope annotation if no scope is found on the given element.
        Parameters:
        element - an AnnotatedElement, cannot be null
        Returns:
        an annotation, or null if the element was not annotated with a scope annotation
        Throws:
        DefinitionException - when the strategy detects an annotation problem
      • isPseudoScope

        boolean isPseudoScope​(java.lang.annotation.Annotation annotation)
        Returns whether the given annotation is a pseudo-scope.
        Parameters:
        annotation - an Annotation, cannot be null
        Returns:
        true if the given Annotation is a pseudo-scope, otherwise false
        Throws:
        java.lang.IllegalArgumentException - if the given annotation is not a scope annotation