public static <A extends Annotation> Optional<A> resolveAnnotation(List<Annotation> annotationList, Class<A> annotationClass,
                                                                       Predicate<Annotation> metaAnnotationCheck) {
        final Optional<Annotation> annotation = annotationList.stream()
                .filter(annotationClass::isInstance)
                .findFirst();
        if (annotation.isPresent()) {
            return annotation.map(annotationClass::cast);
        }
        return AnnotationHelper.resolveNestedAnnotations(annotationList.stream(), annotationClass, metaAnnotationCheck);
    }
Select the instance of the specified annotation type from the given list. 

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

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