spring-framework / org.springframework.core.annotation / AnnotatedElementUtils / isAnnotated

isAnnotated

open static fun isAnnotated(element: AnnotatedElement, annotationType: Class<out Annotation>): Boolean

Determine if an annotation of the specified annotationType is present on the supplied AnnotatedElement or within the annotation hierarchy above the specified element.

If this method returns true, then #getMergedAnnotationAttributes will return a non-null value.

This method follows get semantics as described in the AnnotatedElementUtils.

Parameters

element - the annotated element

annotationType - the annotation type to find

Return
true if a matching annotation is present

Since
4.2.3

See Also
#hasAnnotation(AnnotatedElement, Class)

open static fun isAnnotated(element: AnnotatedElement, annotationName: String): Boolean

Determine if an annotation of the specified annotationName is present on the supplied AnnotatedElement or within the annotation hierarchy above the specified element.

If this method returns true, then #getMergedAnnotationAttributes will return a non-null value.

This method follows get semantics as described in the AnnotatedElementUtils.

Parameters

element - the annotated element

annotationName - the fully qualified class name of the annotation type to find

Return
true if a matching annotation is present