Class XAnnotationUtils


  • public final class XAnnotationUtils
    extends Object
    Utility methods for Annotation.
    Since:
    8.3.0
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • XAnnotationUtils

        public XAnnotationUtils()
    • Method Detail

      • getEnumConstantAnnotation

        public static <A extends Annotation> A getEnumConstantAnnotation​(Enum<?> enumConstant,
                                                                         Class<A> annotationType)
        Get an annotation from an enum constant, i.e. an annotation applied directly to an enum constant.
        Type Parameters:
        A - The annotation type.
        Parameters:
        enumConstant - The enum constant to get the annotation from.
        annotationType - The annotation type to get.
        Returns:
        The annotation or null if the annotation is not present.
      • enumConstantHasAnnotation

        public static <A extends Annotation> boolean enumConstantHasAnnotation​(Enum<?> enumConstant,
                                                                               Class<A> annotationType)
        Checks whether an enum constant has a specific annotation.
        Type Parameters:
        A - The annotation type.
        Parameters:
        enumConstant - The enum constant to get the annotation from.
        annotationType - The annotation type to get.
        Returns:
        True if the annotation is present, false otherwise.