public void processClass()

in geronimo-openapi-impl/src/main/java/org/apache/geronimo/microprofile/openapi/impl/processor/AnnotationProcessor.java [158:206]


    public void processClass(final String basePath, final OpenAPI api, final AnnotatedElement annotatedType,
                             final Stream<AnnotatedMethodElement> methods) {
        final Path path = annotatedType.getAnnotation(Path.class);
        if (api.getPaths() == null) {
            api.paths(new PathsImpl());
        }

        Stream.of(annotatedType.getAnnotationsByType(Tag.class))
                .map(t -> of(t.ref()).filter(it -> !it.isEmpty())
                        .flatMap(ref -> api.getTags().stream().filter(it -> it.getName().equals(ref)).findFirst())
                        .orElseGet(() -> mapTag(t))).forEach(api::addTag);

        Stream.of(annotatedType.getAnnotationsByType(SecurityScheme.class))
                .forEach(s -> {
                    if (api.getComponents() == null) {
                        api.setComponents(new ComponentsImpl());
                    }
                    api.getComponents().addSecurityScheme(s.securitySchemeName(), mapSecurityScheme(s));
                });
        methods.filter(
                m -> Stream.of(m.getAnnotations()).anyMatch(it -> it.annotationType().getName().startsWith("javax.ws.rs.")))
                .forEach(m -> {
                    final Path nestedPath = m.getAnnotation(Path.class);
                    final String completePath = buildPath(basePath, path, nestedPath);
                    if (m.isAnnotationPresent(GET.class)) {
                        getPathItem(api, completePath).setGET(buildOperation(api, m, annotatedType, "GET", completePath));
                    } else if (m.isAnnotationPresent(PUT.class)) {
                        getPathItem(api, completePath).setPUT(buildOperation(api, m, annotatedType, "PUT", completePath));
                    } else if (m.isAnnotationPresent(POST.class)) {
                        getPathItem(api, completePath).setPOST(buildOperation(api, m, annotatedType, "POST", completePath));
                    } else if (m.isAnnotationPresent(HEAD.class)) {
                        getPathItem(api, completePath).setHEAD(buildOperation(api, m, annotatedType, "HEAD", completePath));
                    } else if (m.isAnnotationPresent(OPTIONS.class)) {
                        getPathItem(api, completePath).setOPTIONS(buildOperation(api, m, annotatedType, "OPTIONS", completePath));
                    } else if (m.isAnnotationPresent(DELETE.class)) {
                        getPathItem(api, completePath).setDELETE(buildOperation(api, m, annotatedType, "DELETE", completePath));
                    } else {
                        Stream.of(m.getAnnotations()).filter(it -> it.annotationType().isAnnotationPresent(HttpMethod.class))
                                .findFirst().ifPresent(http -> {
                            final String mtd = http.annotationType().getAnnotation(HttpMethod.class).value();
                            if ("TRACE".equals(mtd)) {
                                getPathItem(api, completePath).setTRACE(buildOperation(api, m, annotatedType, mtd, completePath));
                            } else if ("PATCH".equals(mtd)) {
                                getPathItem(api, completePath).setPATCH(buildOperation(api, m, annotatedType, mtd, completePath));
                            } // else: how to map it
                        });
                    }
                });
    }