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

com.wordnik.swagger.jaxrs.config.DefaultJaxrsScanner Maven / Gradle / Ivy

package com.wordnik.swagger.jaxrs.config;

import com.wordnik.swagger.config.Scanner;

import java.util.*;

import javax.servlet.ServletConfig;
import javax.ws.rs.core.Application;

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) {
          if(o instanceof Class)
            output.add((Class)o);
        }
      }
    }
    return output;
  }

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

  public boolean prettyPrint() {
    return prettyPrint;
  }

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