public static <A extends Annotation> Optional<A> resolveAnnotation(ResolvedMember<?> member, Class<A> annotationClass,
                                                                       Predicate<Annotation> metaAnnotationCheck) {
        final A annotation = member.getAnnotations().get(annotationClass);
        if (annotation == null) {
            return AnnotationHelper.resolveNestedAnnotations(StreamSupport.stream(member.getAnnotations().spliterator(), false),
                    annotationClass, metaAnnotationCheck);
        }
        return Optional.of(annotation);
    }
Resolves the specified annotation on the given resolved member and resolve nested annotations.

@param <A> the generic type of the annotation
@param member where to look for the specified annotation
@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