Merge pull request #2469 from FOCONIS/pr/enh/helper_methods_annotation_util

Add metaHas and metaFindAll in AnnotationUtil
This commit is contained in:
Rob Bygrave
2021-12-20 10:28:32 +13:00
committed by GitHub
@@ -71,6 +71,20 @@ public class AnnotationUtil {
return typeGet(clazz, annotation) != null;
}
/**
* Check if an element is annotated with an annotation of given type searching meta-annotations.
*/
public static boolean metaHas(AnnotatedElement element, Class<?> annotationType) {
return !metaFindAll(element, annotationType).isEmpty();
}
/**
* Find all the annotations of a given type searching meta-annotations.
*/
public static Set<Annotation> metaFindAll(AnnotatedElement element, Class<?> annotationType) {
return metaFindAllFor(element, Collections.singleton(annotationType));
}
/**
* Find all the annotations for the filter searching meta-annotations.
*/