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!
Some utilities are published via the maintained AnnotationSupport
class.
Annotation, AnnotatedElement, org.junit.platform.commons.support.AnnotationSupport
| Modifier and Type | Field and Description |
|---|---|
| private static final ConcurrentHashMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static List | findAnnotatedFields(Class<?> clazz, Class<? extends Annotation> annotationType, Predicate<Field> predicate)
|
| public static List | Returns: the list of all such fields found; neithernull nor mutablethe class or interface in which to find the fields; never clazz, Class<? extends Annotation> nullthe annotation type to search for; never annotationType, Predicate<Field> nullthe field filter; never predicate, ReflectionUtils.nullthe hierarchy traversal mode; never traversalModenullFind all fields of the supplied class or interface
that are annotated or meta-annotated with the specified
|
| public static List | findAnnotatedMethods(Class<?> clazz, Class<? extends Annotation> annotationType, ReflectionUtils.
|
| public static <A extends Annotation> Optional | |
| public static <A extends Annotation> Optional | |
| public static <A extends Annotation> Optional | |
| private static <A extends Annotation> Optional | findAnnotation(@Nullable AnnotatedElement element, Class<A> annotationType, boolean inherited, Set<Annotation> visited)
|
| public static < the annotation type A extends Annotation> Optional | Returns: anOptional containing the annotation; never null but
potentially emptythe class on which to search for the annotation; may be clazz, Class<A> nullthe annotation type to search for; never annotationType, boolean nullwhether the enclosing class hierarchy should
be searched searchEnclosingClasses)Find the first annotation of the specified type that is either directly present, meta-present, or indirectly present on the supplied class, optionally searching recursively through the enclosing class hierarchy if not found on the supplied class. |
| private static <A extends Annotation> Optional | findMetaAnnotation(Class<A> annotationType, Annotation[] candidates, boolean inherited, Set<Annotation> visited)
|
| public static List | findPublicAnnotatedFields(Class<?> clazz, Class<?> fieldType, Class<? extends Annotation> annotationType)
|
| public static <A extends Annotation> List | findRepeatableAnnotations(@Nullable Optional<? extends AnnotatedElement> element, Class<A> annotationType)
|
| public static <A extends Annotation> List | |
| public static <A extends Annotation> List | |
| private static <A extends Annotation> void | findRepeatableAnnotations(AnnotatedElement element, Class<A> annotationType, Class<? extends Annotation> containerType, boolean inherited, Set<A> found, Set<Annotation> visited)
|
| private static <A extends Annotation> void | findRepeatableAnnotations(Annotation[] candidates, Class<A> annotationType, Class<? extends Annotation> containerType, boolean inherited, Set<A> found, Set<Annotation> visited)
|
| private static @Nullable AnnotatedElement | Returns: the suppliedParameter, or the effective Parameter
if the aforementioned bug is detected, or null if the bug is detected and
the supplied index is 0Due to a bug in |
| public static boolean | isAnnotated(@Nullable Optional<? extends AnnotatedElement> element, Class<? extends Annotation> annotationType)
Determine if an annotation of |
| public static boolean | |
| public static boolean | Returns: true if the annotation is present or meta-presentthe element on which to search for the annotation; may be
element, Class<? extends Annotation> nullthe annotation type to search for; never annotationType)nullDetermine if an annotation of |
| private static boolean | |
| private static boolean | isRepeatableAnnotationContainer(Class<? extends Annotation> candidateContainerType)
Determine if the supplied annotation type is a container for a repeatable annotation. |
| repeatableAnnotationContainerCache | back to summary |
|---|---|
| private static final ConcurrentHashMap<Class<? extends Annotation>, Boolean> repeatableAnnotationContainerCache | |
| AnnotationUtils | back to summary |
|---|---|
| private AnnotationUtils() | |
| findAnnotatedFields | back to summary |
|---|---|
| public static List | |
| findAnnotatedFields | back to summary |
|---|---|
| public static List Find all fields of the supplied class or interface
that are annotated or meta-annotated with the specified
| |
| findAnnotatedMethods | back to summary |
|---|---|
| public static List | |
| findAnnotation | back to summary |
|---|---|
public static <A extends Annotation> Optional
| |
| findAnnotation | back to summary |
|---|---|
public static <A extends Annotation> Optional
| |
| findAnnotation | back to summary |
|---|---|
| public static <A extends Annotation> Optional | |
| findAnnotation | back to summary |
|---|---|
| private static <A extends Annotation> Optional | |
| findAnnotation | back to summary |
|---|---|
| public static <A extends Annotation> Optional Find the first annotation of the specified type that is either directly present, meta-present, or indirectly present on the supplied class, optionally searching recursively through the enclosing class hierarchy if not found on the supplied class. The enclosing class hierarchy will only be searched above an inner class (i.e., a non-static member class).
| |
| findMetaAnnotation | back to summary |
|---|---|
| private static <A extends Annotation> Optional | |
| findPublicAnnotatedFields | back to summary |
|---|---|
| public static List | |
| findRepeatableAnnotations | back to summary |
|---|---|
public static <A extends Annotation> List
| |
| findRepeatableAnnotations | back to summary |
|---|---|
public static <A extends Annotation> List
| |
| findRepeatableAnnotations | back to summary |
|---|---|
| public static <A extends Annotation> List | |
| findRepeatableAnnotations | back to summary |
|---|---|
| private static <A extends Annotation> void findRepeatableAnnotations(AnnotatedElement element, Class<A> annotationType, Class<? extends Annotation> containerType, boolean inherited, Set<A> found, Set<Annotation> visited) | |
| findRepeatableAnnotations | back to summary |
|---|---|
private static <A extends Annotation> void findRepeatableAnnotations(Annotation[] candidates, Class<A> annotationType, Class<? extends Annotation> containerType, boolean inherited, Set<A> found, Set<Annotation> visited)
| |
| getEffectiveAnnotatedParameter | back to summary |
|---|---|
| private static @Nullable AnnotatedElement getEffectiveAnnotatedParameter(Parameter parameter, int index) Due to a bug in Bug in
| |
| isAnnotated | back to summary |
|---|---|
| public static boolean isAnnotated(@Nullable Optional<? extends AnnotatedElement> element, Class<? extends Annotation> annotationType) Determine if an annotation of
| |
| isAnnotated | back to summary |
|---|---|
public static boolean isAnnotated(Parameter parameter, int index, Class<? extends Annotation> annotationType)
| |
| isAnnotated | back to summary |
|---|---|
| public static boolean isAnnotated(@Nullable AnnotatedElement element, Class<? extends Annotation> annotationType) Determine if an annotation of
| |
| isInJavaLangAnnotationPackage | back to summary |
|---|---|
| private static boolean isInJavaLangAnnotationPackage(Class<? extends Annotation> annotationType) | |
| isRepeatableAnnotationContainer | back to summary |
|---|---|
| private static boolean isRepeatableAnnotationContainer(Class<? extends Annotation> candidateContainerType) Determine if the supplied annotation type is a container for a repeatable annotation.
| |