Class Annotations


  • public class Annotations
    extends java.lang.Object
    Annotation utilities.
    • Constructor Summary

      Constructors 
      Constructor Description
      Annotations()  
    • Method Summary

      Modifier and Type Method Description
      static void checkForMisplacedScopeAnnotations​(java.lang.Class<?> type, java.lang.Object source, Errors errors)
      Adds an error if there is a misplaced annotations on type.
      static java.lang.annotation.Annotation findBindingAnnotation​(Errors errors, java.lang.reflect.Member member, java.lang.annotation.Annotation[] annotations)
      Returns the binding annotation on member, or null if there isn't one.
      static java.lang.Class<? extends java.lang.annotation.Annotation> findScopeAnnotation​(Errors errors, java.lang.annotation.Annotation[] annotations)
      Returns the scoping annotation, or null if there isn't one.
      static java.lang.Class<? extends java.lang.annotation.Annotation> findScopeAnnotation​(Errors errors, java.lang.Class<?> implementation)
      Returns the scope annotation on type, or null if none is specified.
      static Key<?> getKey​(TypeLiteral<?> type, java.lang.reflect.Member member, java.lang.annotation.Annotation[] annotations, Errors errors)
      Gets a key for the given type, member and annotations.
      static boolean isRetainedAtRuntime​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      Returns true if the given annotation is retained at runtime.
      static boolean isScopeAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)  
      • Methods inherited from class java.lang.Object

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

      • Annotations

        public Annotations()
    • Method Detail

      • isRetainedAtRuntime

        public static boolean isRetainedAtRuntime​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
        Returns true if the given annotation is retained at runtime.
      • findScopeAnnotation

        public static java.lang.Class<? extends java.lang.annotation.Annotation> findScopeAnnotation​(Errors errors,
                                                                                                     java.lang.Class<?> implementation)
        Returns the scope annotation on type, or null if none is specified.
      • findScopeAnnotation

        public static java.lang.Class<? extends java.lang.annotation.Annotation> findScopeAnnotation​(Errors errors,
                                                                                                     java.lang.annotation.Annotation[] annotations)
        Returns the scoping annotation, or null if there isn't one.
      • isScopeAnnotation

        public static boolean isScopeAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      • checkForMisplacedScopeAnnotations

        public static void checkForMisplacedScopeAnnotations​(java.lang.Class<?> type,
                                                             java.lang.Object source,
                                                             Errors errors)
        Adds an error if there is a misplaced annotations on type. Scoping annotations are not allowed on abstract classes or interfaces.
      • getKey

        public static Key<?> getKey​(TypeLiteral<?> type,
                                    java.lang.reflect.Member member,
                                    java.lang.annotation.Annotation[] annotations,
                                    Errors errors)
                             throws ErrorsException
        Gets a key for the given type, member and annotations.
        Throws:
        ErrorsException
      • findBindingAnnotation

        public static java.lang.annotation.Annotation findBindingAnnotation​(Errors errors,
                                                                            java.lang.reflect.Member member,
                                                                            java.lang.annotation.Annotation[] annotations)
        Returns the binding annotation on member, or null if there isn't one.