Class AnnotationHelper


  • public class AnnotationHelper
    extends java.lang.Object

    Purpose:Provide a class which is responsible for returning Annotations from AnnotatedElements. This class can be extended in the case that the annotation data is being provided from an external source.

    Author:
    mmacivor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.annotation.Annotation getAnnotation​(java.lang.reflect.AnnotatedElement elem, java.lang.Class annotationClass)
      Get an annotation of type annotationClass if it's present on the AnnotatedElement elem.
      java.lang.annotation.Annotation[] getAnnotations​(java.lang.reflect.AnnotatedElement elem)
      Get all annotations that exist on the AnnotatedElement elem
      java.lang.annotation.Annotation[] getDeclaredAnnotations​(java.lang.reflect.AnnotatedElement elem)
      Get all annotations that are defined directly on the AnnotatedElement (excluding inherited annotations).
      boolean isAnnotationPresent​(java.lang.reflect.AnnotatedElement elem, java.lang.Class annotationClass)
      Return true if the annotation annotationClass exists on the annotatedElement elem.
      • Methods inherited from class java.lang.Object

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

      • AnnotationHelper

        public AnnotationHelper()
    • Method Detail

      • getAnnotation

        public java.lang.annotation.Annotation getAnnotation​(java.lang.reflect.AnnotatedElement elem,
                                                             java.lang.Class annotationClass)
        Get an annotation of type annotationClass if it's present on the AnnotatedElement elem.
      • getAnnotations

        public java.lang.annotation.Annotation[] getAnnotations​(java.lang.reflect.AnnotatedElement elem)
        Get all annotations that exist on the AnnotatedElement elem
      • isAnnotationPresent

        public boolean isAnnotationPresent​(java.lang.reflect.AnnotatedElement elem,
                                           java.lang.Class annotationClass)
        Return true if the annotation annotationClass exists on the annotatedElement elem.
      • getDeclaredAnnotations

        public java.lang.annotation.Annotation[] getDeclaredAnnotations​(java.lang.reflect.AnnotatedElement elem)
        Get all annotations that are defined directly on the AnnotatedElement (excluding inherited annotations).