• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java License类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.swagger.models.License的典型用法代码示例。如果您正苦于以下问题:Java License类的具体用法?Java License怎么用?Java License使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



License类属于io.swagger.models包,在下文中一共展示了License类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import io.swagger.models.License; //导入依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
  Info info = new Info()
    .title("Swagger Server")
    .description("RESTful API specification for the ElasTest Instrumentation Manager (EIM)")
    .termsOfService("TBD")
    .contact(new Contact()
      .email("[email protected]"))
    .license(new License()
      .name("Apache 2.0")
      .url("http://www.apache.org/licenses/LICENSE-2.0.html"));

  ServletContext context = config.getServletContext();
  Swagger swagger = new Swagger().info(info);
  String propertiesFile = "/WEB-INF/bootstrap.properties";
  Properties.load(config.getServletContext().getResourceAsStream(propertiesFile), propertiesFile);
  new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
}
 
开发者ID:elastest,项目名称:elastest-instrumentation-manager,代码行数:19,代码来源:Bootstrap.java


示例2: apply

import io.swagger.models.License; //导入依赖的package包/类
@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) {
    Info info = params.info;
    License license = info.getLicense();
    String termOfService = info.getTermsOfService();
    if ((license != null && (isNotBlank(license.getName()) || isNotBlank(license.getUrl()))) || isNotBlank(termOfService)) {
        markupDocBuilder.sectionTitleLevel(params.titleLevel, labels.getLabel(LICENSE_INFORMATION));
        MarkupDocBuilder paragraph = copyMarkupDocBuilder(markupDocBuilder);
        if (license != null) {
            if (isNotBlank(license.getName())) {
                paragraph.italicText(labels.getLabel(LICENSE)).textLine(COLON + license.getName());
            }
            if (isNotBlank(license.getUrl())) {
                paragraph.italicText(labels.getLabel(LICENSE_URL)).textLine(COLON + license.getUrl());
            }
        }

        paragraph.italicText(labels.getLabel(TERMS_OF_SERVICE)).textLine(COLON + termOfService);

        markupDocBuilder.paragraph(paragraph.toString(), true);
    }

    return markupDocBuilder;
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:25,代码来源:LicenseInfoComponent.java


示例3: testLicenseInfoComponent

import io.swagger.models.License; //导入依赖的package包/类
@Test
public void testLicenseInfoComponent() throws URISyntaxException {

    Info info = new Info()
            .license(new License().name("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0"))
            .termsOfService("Bla bla bla");

    Swagger2MarkupConverter.Context context = createContext();
    MarkupDocBuilder markupDocBuilder = context.createMarkupDocBuilder();

    markupDocBuilder = new LicenseInfoComponent(context).apply(markupDocBuilder, LicenseInfoComponent.parameters(info, OverviewDocument.SECTION_TITLE_LEVEL));
    markupDocBuilder.writeToFileWithoutExtension(outputDirectory, StandardCharsets.UTF_8);

    Path expectedFile = getExpectedFile(COMPONENT_NAME);
    DiffUtils.assertThatFileIsEqual(expectedFile, outputDirectory, getReportName(COMPONENT_NAME));

}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:18,代码来源:LicenseInfoComponentTest.java


示例4: convertLicense

import io.swagger.models.License; //导入依赖的package包/类
private License convertLicense(io.swagger.annotations.License licenseAnnotation) {
  License license = new License();

  license.setName(licenseAnnotation.name());
  license.setUrl(licenseAnnotation.url());

  return license;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:SwaggerDefinitionProcessor.java


示例5: init

import io.swagger.models.License; //导入依赖的package包/类
public void init() {
    if (!config.isConfigOk()) {
        return;
    }

    swagger = new Swagger();
    swagger.setHost(config.getHost());
    swagger.setBasePath("/");
    swagger.addScheme(HTTP);
    swagger.addScheme(HTTPS);


    Info swaggerInfo = new Info();
    swaggerInfo.setDescription(config.getDescription());
    swaggerInfo.setVersion(config.getVersion());
    swaggerInfo.setTitle(config.getTitle());
    swaggerInfo.setTermsOfService(config.getTermsOfService());

    Contact contact = new Contact();
    contact.setName(config.getContactName());
    contact.setEmail(config.getContactEmail());
    contact.setUrl(config.getContactUrl());
    swaggerInfo.setContact(contact);

    License license = new License();
    license.setName(config.getLicenseName());
    license.setUrl(config.getLicenseUrl());
    swaggerInfo.setLicense(license);


    swagger.setInfo(swaggerInfo);

    List<Class> classes = ClassScanner.scanClassByAnnotation(RequestMapping.class, false);

    Reader.read(swagger, classes);

}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:38,代码来源:JbootSwaggerManager.java


示例6: updateInfoFromConfig

import io.swagger.models.License; //导入依赖的package包/类
private void updateInfoFromConfig() {
    if (getSwagger().getInfo() == null) {
        setInfo(new Info());
    }

    if (StringUtils.isNotBlank(getDescription())) {
        getSwagger().getInfo().setDescription(getDescription());
    }

    if (StringUtils.isNotBlank(getTitle())) {
        getSwagger().getInfo().setTitle(getTitle());
    }

    if (StringUtils.isNotBlank(getVersion())) {
        getSwagger().getInfo().setVersion(getVersion());
    }

    if (StringUtils.isNotBlank(getTermsOfServiceUrl())) {
        getSwagger().getInfo().setTermsOfService(getTermsOfServiceUrl());
    }

    if (getContact() != null) {
        getSwagger().getInfo().setContact((new Contact()).name(getContact()));
    }

    if (getLicense() != null && getLicenseUrl() != null) {
        getSwagger().getInfo().setLicense((new License()).name(getLicense()).url(getLicenseUrl()));
    }

    if (getSchemes() != null) {
        for (String scheme : getSchemes()) {
            reader.getSwagger().scheme(Scheme.forValue(scheme));
        }
    }

    reader.getSwagger().setInfo(getInfo());
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:38,代码来源:MSF4JBeanConfig.java


示例7: getResourceSwaggerJson

import io.swagger.models.License; //导入依赖的package包/类
public String getResourceSwaggerJson(){
	
	SwaggerSerializers.setPrettyPrint(true);				
	ReaderConfig readerConfig = new PlayReaderConfig();
	
	Swagger swagger = new Swagger();
	PlaySwaggerConfig config = PlayConfigFactory.getConfig();
	
	swagger.setHost(config.getHost());
	swagger.setBasePath(config.getBasePath());		
	
	Info info = new Info();
	info.setVersion(config.getVersion());
	info.setTitle(config.getTitle());
	info.setContact(new Contact().name(config.getContact()));
	info.setLicense(new License().name(config.getLicense()).url(config.getLicenseUrl()));
	info.setDescription(config.getDescription());
	info.setTermsOfService(config.getTermsOfServiceUrl());
			
	swagger.setInfo(info);
	
	PlayReader reader = new PlayReader(swagger, readerConfig);
	swagger = reader.read(controllerClasses);
		   
	ObjectMapper commonMapper = Json.mapper();
	
	try {
		return commonMapper.writeValueAsString(swagger);
	} catch (JsonProcessingException e) {
		Logger.error(e.getMessage());			
		return "";
	}
}
 
开发者ID:abhishekShukla,项目名称:swagger-play,代码行数:34,代码来源:ApiHelpInventory.java


示例8: from

import io.swagger.models.License; //导入依赖的package包/类
private License from(io.swagger.annotations.License licenseAnnotation) {
    License license = new License()
            .name(emptyToNull(licenseAnnotation.name()))
            .url(emptyToNull(licenseAnnotation.url()));
    if (license.getName() == null && license.getUrl() == null) {
        license = null;
    }
    return license;
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:10,代码来源:ApiSource.java


示例9: initSwagger

import io.swagger.models.License; //导入依赖的package包/类
public void initSwagger(BeanConfig swaggerConfig, Map<String, Object> config) {
    // configure swagger options
    String s = (String) config.get("swagger.version");
    if (s != null) {
        swaggerConfig.setVersion(s);
    }
    s = (String) config.get("base.path");
    if (s != null) {
        swaggerConfig.setBasePath(s);
    }
    s = (String) config.get("host");
    if (s != null) {
        swaggerConfig.setHost(s);
    }
    s = (String) config.get("cors");
    if (s != null) {
        cors = "true".equalsIgnoreCase(s);
    }
    s = (String) config.get("schemes");
    if (s == null) {
        // deprecated due typo
        s = (String) config.get("schemas");
    }
    if (s != null) {
        String[] schemes = s.split(",");
        swaggerConfig.setSchemes(schemes);
    } else {
        // assume http by default
        swaggerConfig.setSchemes(new String[]{"http"});
    }

    String version = (String) config.get("api.version");
    String title = (String) config.get("api.title");
    String description = (String) config.get("api.description");
    String termsOfService = (String) config.get("api.termsOfService");
    String licenseName = (String) config.get("api.license.name");
    String licenseUrl = (String) config.get("api.license.url");
    String contactName = (String) config.get("api.contact.name");
    String contactUrl = (String) config.get("api.contact.url");
    String contactEmail = (String) config.get("api.contact.email");

    Info info = new Info();
    info.setVersion(version);
    info.setTitle(title);
    info.setDescription(description);
    info.setTermsOfService(termsOfService);

    if (licenseName != null || licenseUrl != null) {
        License license = new License();
        license.setName(licenseName);
        license.setUrl(licenseUrl);
        info.setLicense(license);
    }

    if (contactName != null || contactUrl != null || contactEmail != null) {
        Contact contact = new Contact();
        contact.setName(contactName);
        contact.setUrl(contactUrl);
        contact.setEmail(contactEmail);
        info.setContact(contact);
    }

    swaggerConfig.setInfo(info);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:65,代码来源:RestSwaggerSupport.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TemplateContextType类代码示例发布时间:2022-05-21
下一篇:
Java SimpleXYSeries类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap