@API(value=Internal) public final class AnnotationUtils extends java.lang.Object
These utilities are intended solely for usage within the JUnit framework itself. Any usage by external parties is not supported. Use at your own risk!
Annotation,
AnnotatedElement| Modifier and Type | Method and Description |
|---|---|
static java.util.List<java.lang.reflect.Method> |
findAnnotatedMethods(java.lang.Class<?> clazz,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
ReflectionUtils.MethodSortOrder sortOrder) |
static <A extends java.lang.annotation.Annotation> |
findAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.Class<A> annotationType)
Find the first annotation of
annotationType that is either present or meta-present on
the supplied element. |
static <A extends java.lang.annotation.Annotation> |
findRepeatableAnnotations(java.lang.reflect.AnnotatedElement element,
java.lang.Class<A> annotationType)
Find all repeatable annotations of
annotationType that are either
present, indirectly present, or meta-present on the supplied AnnotatedElement. |
static boolean |
isAnnotated(java.lang.reflect.AnnotatedElement element,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Determine if an annotation of
annotationType is either present or meta-present on the
supplied element. |
public static boolean isAnnotated(java.lang.reflect.AnnotatedElement element,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType is either present or meta-present on the
supplied element.findAnnotation(AnnotatedElement, Class)public static <A extends java.lang.annotation.Annotation> java.util.Optional<A> findAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.Class<A> annotationType)
annotationType that is either present or meta-present on
the supplied element.public static <A extends java.lang.annotation.Annotation> java.util.List<A> findRepeatableAnnotations(java.lang.reflect.AnnotatedElement element,
java.lang.Class<A> annotationType)
annotationType that are either
present, indirectly present, or meta-present on the supplied AnnotatedElement.
This method extends the functionality of AnnotatedElement.getAnnotationsByType(Class)
with additional support for meta-annotations.
nullpublic static java.util.List<java.lang.reflect.Method> findAnnotatedMethods(java.lang.Class<?> clazz,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
ReflectionUtils.MethodSortOrder sortOrder)