public static <A extends Annotation> Optional<A> resolveAnnotation(AnnotatedElement annotatedElement, Class<A> annotationClass,
                                                                       Predicate<Annotation> metaAnnotationCheck) {
        final A annotation = annotatedElement.getAnnotation(annotationClass);
        if (annotation == null) {
            return AnnotationHelper.resolveNestedAnnotations(Arrays.stream(annotatedElement.getAnnotations()),
                    annotationClass, metaAnnotationCheck);
        }
        return Optional.of(annotation);
    }
Select the instance of the specified annotation type from the given annotatedElement's annotations. 

<p>Also considering meta annotations (i.e., annotations on annotations) if a meta annotation is 
deemed eligible according to the given <code>metaAnnotationPredicate</code>.</p>

@param <A> the generic type of the annotation
@param annotatedElement where to look for the specified annotation
@param annotationClass the class of the annotation to look for
@param metaAnnotationCheck the predicate indicating meta annotations
@return an empty entry if not found
jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/AnnotationHelper.java