public class AnnotationUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Annotation> |
getAnnotation(AnnotatedElement annotatedType,
Class<T> annotationClass)
Gets the annotation of the given annotation type from the given annotated class as an optional.
|
static <T extends Annotation> |
getAnnotationSafely(AnnotatedElement annotatedType,
Class<T> annotationClass)
Gets the annotation of the given annotation type safely from the given annotated class.
|
public static <T extends Annotation> Optional<T> getAnnotationSafely(AnnotatedElement annotatedType, Class<T> annotationClass)
null
.T
- The type of the annotation returned.annotatedType
- The given annotated type. It can not be null
.annotationClass
- The given annotation type. It can not be null
.public static <T extends Annotation> T getAnnotation(AnnotatedElement annotatedType, Class<T> annotationClass)
T
- The type of the annotation returned.annotatedType
- The given annotated type.annotationClass
- The given annotation type.Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries