Class AnnotationHelper


  • public class AnnotationHelper
    extends Object
    Helper class around annotations.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • AnnotationHelper

        public AnnotationHelper()
    • Method Detail

      • hasAnnotation

        public static boolean hasAnnotation​(Class cls,
                                            Class annotation)
        Returns whether the class has the specified annotation.
        Parameters:
        cls - the class to check for annotation
        annotation - the annotation to look for
        Returns:
        true if annotation is present
      • isDeprecated

        public static boolean isDeprecated​(Class cls)
        Returns whether the class is marked as deprecated (Deprecated or DeprecatedClass).
        Parameters:
        cls - the class to check
        Returns:
        true if marked as deprecated
      • getDeprecationWarning

        public static String getDeprecationWarning​(Class cls)
        Generates a deprecation warning if the class is marked as such.
        Parameters:
        cls - the class to check
        Returns:
        null if not deprecated, otherwise warning message