ADD: metaHas and metaFindAll as functional sugar

This commit is contained in:
Jonas Pöhler
2021-11-12 15:56:07 +01:00
parent e7cffe99d6
commit f98292be41
@@ -2,6 +2,7 @@ package io.ebean.util;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -72,6 +73,14 @@ public class AnnotationUtil {
return typeGet(clazz, annotation) != null;
}
public static boolean metaHas(AnnotatedElement element, Class<?> annotationType) {
return !metaFindAll(element, annotationType).isEmpty();
}
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.
*/