Package io.quarkus.test.util.annotations
Class AnnotationUtils
java.lang.Object
io.quarkus.test.util.annotations.AnnotationUtils
Provides utility methods for obtaining annotations on test classes.
This class is basically an adaptation of
AnnotationSupport
altered to include the element which was annotated in the result and filtered out to only contain methods we use.-
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends Annotation>
Optional<AnnotationContainer<A>>findAnnotation(AnnotatedElement element, Class<A> annotationType) Find the first annotation ofannotationTypethat is either directly present, meta-present, or indirectly present on the suppliedelement.
-
Method Details
-
findAnnotation
public static <A extends Annotation> Optional<AnnotationContainer<A>> findAnnotation(AnnotatedElement element, Class<A> annotationType) Find the first annotation ofannotationTypethat is either directly present, meta-present, or indirectly present on the suppliedelement.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 (meaning that the same process will be repeated for superclasses if
Inheritedis present onannotationType).- Type Parameters:
A- the annotation type- Parameters:
element- the element on which to search for the annotation; may benullannotationType- the annotation type to search for; nevernull- Returns:
- an
Optionalcontaining the annotation and the element on which it was present; nevernullbut potentially empty
-