Package com.couchbase.client.core.util
Class CbAnnotations
java.lang.Object
com.couchbase.client.core.util.CbAnnotations
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Annotation>
TfindAnnotation
(Annotation annotation, Class<T> annotationClass) Searches the given annotation and any meta-annotations, returning the first annotation of the given class.static <T extends Annotation>
TfindAnnotation
(AnnotatedElement element, Class<T> annotationClass) Searches the element for an annotation of the given class and returns the first match.
-
Method Details
-
findAnnotation
public static <T extends Annotation> T findAnnotation(AnnotatedElement element, Class<T> annotationClass) Searches the element for an annotation of the given class and returns the first match. This is a recursive search that also considers meta-annotations.- Parameters:
element
- the element to searchannotationClass
- the type of annotation to look for- Returns:
- Matching annotation, or null if not found.
-
findAnnotation
public static <T extends Annotation> T findAnnotation(Annotation annotation, Class<T> annotationClass) Searches the given annotation and any meta-annotations, returning the first annotation of the given class.- Parameters:
annotation
- the root annotation to searchannotationClass
- the type of annotation to look for- Returns:
- Matching annotation, or null if not found.
-