private Throwable validate()

in safeguard-impl/src/main/java/org/apache/safeguard/impl/cdi/SafeguardExtension.java [280:294]


    private Throwable validate(final Class<? extends Annotation> marker,
                               final Annotated type,
                               final Consumer<InvocationContext> contextConsumer) {
        final boolean classHasMarker = type.isAnnotationPresent(marker);
        final AnnotatedType<?> annotatedType = AnnotatedType.class.cast(type);
        try {
            annotatedType.getMethods().stream()
                         .filter(it -> classHasMarker || it.isAnnotationPresent(marker))
                         .map(m -> new MockInvocationContext(m.getJavaMember()))
                         .forEach(contextConsumer);
            return null;
        } catch (final RuntimeException re) {
            return new DefinitionException(re);
        }
    }