Package io.quarkus.test.util.annotations
Class AnnotationUtils
- java.lang.Object
-
- io.quarkus.test.util.annotations.AnnotationUtils
-
public final class AnnotationUtils extends Object
Provides utility methods for obtaining annotations on test classes. This class is basically an adaptation ofAnnotationSupportaltered to include the element which was annotated in the result and filtered out to only contain methods we use.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Method Detail
-
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
-
-