Class ConfigurableAnnotationStrategy

    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigurableAnnotationStrategy​(java.lang.Class<? extends java.lang.annotation.Annotation> inject, java.lang.Class<? extends java.lang.annotation.Annotation> qualifier, java.lang.Class<? extends java.lang.annotation.Annotation> optional)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<java.lang.annotation.Annotation> getInjectAnnotations​(java.lang.reflect.AnnotatedElement element)
      Returns all Annotations on the given AnnotatedElement which are inject annotations.
      java.util.Set<java.lang.annotation.Annotation> getQualifiers​(java.lang.reflect.AnnotatedElement element)
      Returns all Annotations on the given AnnotatedElement which are qualifier annotations.
      boolean isOptional​(java.lang.reflect.AnnotatedElement element)
      Checks if the given AnnotatedElement is optional.
      boolean isQualifier​(java.lang.annotation.Annotation annotation)
      Checks if the given Annotation is a qualifier annotation.
      • Methods inherited from class java.lang.Object

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

      • ConfigurableAnnotationStrategy

        public ConfigurableAnnotationStrategy​(java.lang.Class<? extends java.lang.annotation.Annotation> inject,
                                              java.lang.Class<? extends java.lang.annotation.Annotation> qualifier,
                                              java.lang.Class<? extends java.lang.annotation.Annotation> optional)
        Constructs a new instance.
        Parameters:
        inject - an inject annotation Class to use, cannot be null
        qualifier - a qualifier annotation Class to use, cannot be null
        optional - an optional annotation Class to use, can be null
    • Method Detail

      • isOptional

        public boolean isOptional​(java.lang.reflect.AnnotatedElement element)
        Description copied from interface: AnnotationStrategy
        Checks if the given AnnotatedElement is optional. If optional and there is no matching dependency, the injector will not thrown an exception but instead will skip injecting fields and will provide null for parameters. This allows having default values for field injection.
        Specified by:
        isOptional in interface AnnotationStrategy
        Parameters:
        element - an AnnotatedElement, cannot be null
        Returns:
        true if the given AnnotatedElement is optional, otherwise false
      • getInjectAnnotations

        public java.util.Set<java.lang.annotation.Annotation> getInjectAnnotations​(java.lang.reflect.AnnotatedElement element)
        Description copied from interface: AnnotationStrategy
        Returns all Annotations on the given AnnotatedElement which are inject annotations.
        Specified by:
        getInjectAnnotations in interface AnnotationStrategy
        Parameters:
        element - an AnnotatedElement, cannot be null
        Returns:
        a modifiable set of Annotations, never null or contains null, but can be empty
      • getQualifiers

        public java.util.Set<java.lang.annotation.Annotation> getQualifiers​(java.lang.reflect.AnnotatedElement element)
        Description copied from interface: AnnotationStrategy
        Returns all Annotations on the given AnnotatedElement which are qualifier annotations.
        Specified by:
        getQualifiers in interface AnnotationStrategy
        Parameters:
        element - an AnnotatedElement, cannot be null
        Returns:
        a modifiable set of Annotations, never null or contains null, but can be empty
      • isQualifier

        public boolean isQualifier​(java.lang.annotation.Annotation annotation)
        Description copied from interface: AnnotationStrategy
        Checks if the given Annotation is a qualifier annotation.
        Specified by:
        isQualifier in interface AnnotationStrategy
        Parameters:
        annotation - an Annotation, cannot be null
        Returns:
        true if the given annotation is a qualifier annotation, otherwise false