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

io.swagger.jaxrs.config.DefaultJaxrsScanner Maven / Gradle / Ivy

There is a newer version: 1.6.14
Show newest version
package io.swagger.jaxrs.config;

import javax.servlet.ServletConfig;
import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;

public class DefaultJaxrsScanner extends AbstractScanner implements JaxrsScanner {
    private boolean prettyPrint = false;

    public Set> classesFromContext(Application app, ServletConfig sc) {
        Set> output = new HashSet>();
        if (app != null) {
            Set> clz = app.getClasses();
            if (clz != null) {
                output.addAll(clz);
            }
            Set singletons = app.getSingletons();
            if (singletons != null) {
                for (Object o : singletons) {
                    output.add(o.getClass());
                }
            }
        }
        return output;
    }

    public Set> classes() {
        return new HashSet>();
    }

    public boolean prettyPrint() {
        return prettyPrint;
    }

    public void setPrettyPrint(boolean shouldPrettyPrint) {
        this.prettyPrint = shouldPrettyPrint;
    }
}