All runtime annotations are provided, both visible and invisible.
That is, all annotations with @Retention values of CLASS and
RUNTIME are returned. Annotations with a @Retention value of SOURCE
is returned only if and only if source for this element is
available.

Note: @Retention values for annotations on local variables that are
not formal parameters are implicitly SOURCE.

getDeclaredAnnotation

getAnnotation

Retrieves the annotation declared on this element that matches
the input annotation type. If this element is a class, then this
will also iteratively search for an annotation of the matching
annotation type on this class's hierarchy.

Returns:

The matching annotation declared on this element or its
hierarchy (if this is a class). Null if none.