io.swagger.config.Scanner Java Examples
The following examples show how to use
io.swagger.config.Scanner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwaggerSpecResource.java From Cheddar with Apache License 2.0 | 5 votes |
protected synchronized Swagger scanResourcesForJaxrsAnnotations(final Application app, final ServletConfig sc) { Swagger swagger = null; final Scanner scanner = ScannerFactory.getScanner(); LOGGER.debug("using scanner " + scanner); if (scanner != null) { SwaggerSerializers.setPrettyPrint(scanner.getPrettyPrint()); swagger = getSwagger(); Set<Class<?>> classes = null; if (scanner instanceof JaxrsScanner) { final JaxrsScanner jaxrsScanner = (JaxrsScanner) scanner; classes = jaxrsScanner.classesFromContext(app, sc); } else { classes = scanner.classes(); } if (classes != null) { final Reader reader = new Reader(swagger); swagger = reader.read(classes); if (scanner instanceof SwaggerConfig) { swagger = ((SwaggerConfig) scanner).configure(swagger); } else { LOGGER.debug("no configurator"); } } } initialized = true; return swagger; }
Example #2
Source File: SwaggerSpecResource.java From Cheddar with Apache License 2.0 | 5 votes |
/** * Will get the swagger configuration from the scanner, if it is of type BeanConfig and return the object. This will * be used in the parsing and formating of the resulting swagger specification. * * @return swagger configuration. If the scanner is not of type io.swagger.jaxrs.config.BeanConfig then null will be * returned. */ private Swagger getSwagger() { final Scanner scanner = ScannerFactory.getScanner(); if (scanner instanceof BeanConfig) { return ((BeanConfig) scanner).getSwagger(); } return null; }