private T getMethodAnnotation()

in safeguard-impl/src/main/java/org/apache/safeguard/impl/annotation/AnnotationFinder.java [95:103]


    private <T extends Annotation> T getMethodAnnotation(final Class<T> type, final Optional<AnnotatedMethod<?>> classMethod) {
        if (classMethod.isPresent()) {
            final T annotation = classMethod.orElseThrow(IllegalArgumentException::new).getAnnotation(type);
            if (annotation != null) {
                return annotation;
            }
        }
        return null;
    }