All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.swagger.v3.jaxrs2.integration.JaxrsApplicationAndResourcePackagesAnnotationScanner Maven / Gradle / Ivy

There is a newer version: 1.2.2.1-jre17
Show newest version
package io.swagger.v3.jaxrs2.integration;

import java.util.HashSet;
import java.util.Set;

/**
 * @since 2.0.10
 */
public class JaxrsApplicationAndResourcePackagesAnnotationScanner extends JaxrsAnnotationScanner {

    public JaxrsApplicationAndResourcePackagesAnnotationScanner() {
        onlyConsiderResourcePackages = true;
    }

    @Override
    public Set> classes() {
        Set> classes = super.classes();
        Set> output = new HashSet<>();
        if (application != null) {
            Set> clzs = application.getClasses();
            if (clzs != null) {
                for (Class clz : clzs) {
                    if (!isIgnored(clz.getName())) {
                        output.add(clz);
                    }
                }
            }
            Set singletons = application.getSingletons();
            if (singletons != null) {
                for (Object o : singletons) {
                    if (!isIgnored(o.getClass().getName())) {
                        output.add(o.getClass());
                    }
                }
            }
        }
        classes.addAll(output);
        return classes;
    }
}