当前位置: 首页>>代码示例>>Java>>正文


Java Reader.read方法代码示例

本文整理汇总了Java中io.swagger.jaxrs.Reader.read方法的典型用法代码示例。如果您正苦于以下问题:Java Reader.read方法的具体用法?Java Reader.read怎么用?Java Reader.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.swagger.jaxrs.Reader的用法示例。


在下文中一共展示了Reader.read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: afterPropertiesSet

import io.swagger.jaxrs.Reader; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
	swagger = new Swagger();
	Info info = new Info();
	info.setTitle("GreetingService");
	swagger.setInfo(info);

	Map<String, Object> beans = applicationContext.getBeansWithAnnotation(SpringTimeService.class);
	Set<Class<?>> classes = new HashSet<Class<?>>();
	for (Object bean : beans.values()) {
		classes.add(bean.getClass());
	}

	Reader reader = new Reader(swagger, ReaderConfigUtils.getReaderConfig(null));
	swagger = reader.read(classes);
}
 
开发者ID:springside,项目名称:springtime,代码行数:17,代码来源:SpringTimeSwaggerDocsController.java

示例2: getSwaggerDocFromAnnotatedClasses

import io.swagger.jaxrs.Reader; //导入方法依赖的package包/类
private String getSwaggerDocFromAnnotatedClasses(ZipFile warZipFile, Swagger swaggerStubModel) throws IOException {
	SwaggerAnnotationsScanner annScan = new SwaggerAnnotationsScanner(classLoader, warZipFile);
	Set<Class<?>> classes = annScan.getScannedClasses();
	Reader reader = new Reader(swaggerStubModel);
	Set<String> stubPaths = null;
	if (swaggerStubModel != null && swaggerStubModel.getPaths() != null) {
		stubPaths = swaggerStubModel.getPaths().keySet();
	}
	Swagger swresult = reader.read(classes);
	swresult = addUrlMapping(swresult, stubPaths, annScan.getUrlMapping());
	String ext = FilenameUtils.getExtension(this.outputFile.getName());
	if (ext.equalsIgnoreCase("json")) {
		return createJSONfromPojo(swresult);
	} else if (ext.equalsIgnoreCase("yaml")){
		return createYAMLfromPojo(swresult);
	}
	
	throw new IllegalArgumentException("Unsupported document type: " + ext);
}
 
开发者ID:WASdev,项目名称:tool.swagger.docgen,代码行数:20,代码来源:SwaggerProcessor.java

示例3: SwaggerHandler

import io.swagger.jaxrs.Reader; //导入方法依赖的package包/类
public SwaggerHandler(
    final Class<? extends Application> applicationClass) {

    final ApplicationPath annotation = applicationClass.getAnnotation(ApplicationPath.class);
    if (annotation != null) {
        baseUri = URI.create(annotation.value()).normalize();
    } else {
        baseUri = URI.create("/");
    }

    Application application;
    try {
        application = applicationClass.newInstance();
    } catch (InstantiationException
        | IllegalAccessException e) {
        throw new ExceptionInInitializerError(e);
    }

    swagger = new ClonableSwagger();
    final Reader swaggerReader = new Reader(swagger);
    final Set<Class<?>> resourceClasses = application.getClasses();
    if (resourceClasses.isEmpty()) {
        final String packageName = applicationClass.getPackage().getName();
        final Reflections reflections = new Reflections(packageName);
        reflections.getTypesAnnotatedWith(Api.class).forEach(swaggerReader::read);
        reflections.getTypesAnnotatedWith(SwaggerDefinition.class).forEach(swaggerReader::read);
    } else {
        swaggerReader.read(applicationClass);
        resourceClasses.forEach(swaggerReader::read);
    }

}
 
开发者ID:trajano,项目名称:app-ms,代码行数:33,代码来源:SwaggerHandler.java

示例4: getSwaggerWithClasses

import io.swagger.jaxrs.Reader; //导入方法依赖的package包/类
protected Swagger getSwaggerWithClasses() {

        try {
            Reader reader = new Reader(null);
            Swagger swagger = reader.read(getSwaggerClasses());

            processSwagger(swagger);

            return swagger;
        }
        catch (Exception ex) {
            logger.error("Uncaught exception attempting to generate Swagger", ex);
            return null;
        }
    }
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:16,代码来源:BaseSwaggerRestProvider.java

示例5: scanResourcesForJaxrsAnnotations

import io.swagger.jaxrs.Reader; //导入方法依赖的package包/类
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;
}
 
开发者ID:travel-cloud,项目名称:Cheddar,代码行数:31,代码来源:SwaggerSpecResource.java


注:本文中的io.swagger.jaxrs.Reader.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。