Class CbAnnotations

    • Method Detail

      • findAnnotation

        public static <T extends Annotation> T findAnnotation​(AnnotatedElement element,
                                                              Class<T> annotationClass)
        Searches the element for an annotation of the given class and returns the first match. This is a recursive search that also considers meta-annotations.
        Parameters:
        element - the element to search
        annotationClass - the type of annotation to look for
        Returns:
        Matching annotation, or null if not found.
      • findAnnotation

        public static <T extends Annotation> T findAnnotation​(Annotation annotation,
                                                              Class<T> annotationClass)
        Searches the given annotation and any meta-annotations, returning the first annotation of the given class.
        Parameters:
        annotation - the root annotation to search
        annotationClass - the type of annotation to look for
        Returns:
        Matching annotation, or null if not found.