private Optional getAnnotationValue()

in log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/Annotations.java [234:252]


    private Optional<String> getAnnotationValue(
            final AnnotatedConstruct element,
            final TypeMirror v2Annotation,
            final Name v2Property,
            final TypeMirror v3Annotation,
            final Name v3Property) {
        return element.getAnnotationMirrors().stream()
                .map(annotation -> {
                    final DeclaredType annotationType = annotation.getAnnotationType();
                    if (v2Annotation != null && types.isSameType(v2Annotation, annotationType)) {
                        return getValueAsString(annotation, v2Property);
                    }
                    return v3Annotation != null && types.isSameType(v3Annotation, annotationType)
                            ? getValueAsString(annotation, v3Property)
                            : null;
                })
                .filter(Objects::nonNull)
                .findAny();
    }