Class AnnotationUtils

java.lang.Object
com.alibaba.fastjson2.util.AnnotationUtils

public final class AnnotationUtils extends Object
Annotation utils transformed from org.junit.platform.commons.util.AnnotationUtils
Author:
lzhpo
  • Method Details

    • findAnnotation

      public static <A extends Annotation> A findAnnotation(AnnotatedElement element, Class<A> annotationType)
      Find the first annotation of annotationType that is either directly present, meta-present, or indirectly present on the supplied element.

      If the element is a class and the annotation is neither directly present nor meta-present on the class, this method will additionally search on interfaces implemented by the class before finding an annotation that is indirectly present on the class.

      Type Parameters:
      A - the annotation
      Parameters:
      element - the element on which to search for the annotation
      annotationType - the annotation type of need to search
      Returns:
      the searched annotation type
    • findAnnotation

      public static <A extends Annotation> A findAnnotation(Annotation annotation, Class<A> annotationType)
      If the annotation's annotationType is not annotationType, then to find the first annotation of annotationType that is either directly present, meta-present, or indirectly present on the supplied element.
      Type Parameters:
      A - the searched annotation type
      Parameters:
      annotation - annotation
      annotationType - the annotation type of need to search
      Returns:
      the searched annotation
    • getAnnotations

      public static Annotation[] getAnnotations(AccessibleObject accessibleObject)
    • getAnnotations

      public static Annotation[] getAnnotations(Class objectClass)
    • getAnnotations

      public static Annotation[] getAnnotations(Parameter parameter)
    • getAnnotations

      public static Annotation[] getAnnotations(AnnotatedElement element)