本文整理汇总了Java中io.swagger.models.Contact类的典型用法代码示例。如果您正苦于以下问题:Java Contact类的具体用法?Java Contact怎么用?Java Contact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Contact类属于io.swagger.models包,在下文中一共展示了Contact类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import io.swagger.models.Contact; //导入依赖的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);
}
示例2: apply
import io.swagger.models.Contact; //导入依赖的package包/类
@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) {
Contact contact = params.contact;
if (isNotBlank(contact.getName()) || isNotBlank(contact.getEmail())) {
markupDocBuilder.sectionTitleLevel(params.titleLevel, labels.getLabel(Labels.CONTACT_INFORMATION));
MarkupDocBuilder paragraphBuilder = copyMarkupDocBuilder(markupDocBuilder);
if (isNotBlank(contact.getName())) {
paragraphBuilder.italicText(labels.getLabel(Labels.CONTACT_NAME))
.textLine(COLON + contact.getName());
}
if (isNotBlank(contact.getEmail())) {
paragraphBuilder.italicText(labels.getLabel(Labels.CONTACT_EMAIL))
.textLine(COLON + contact.getEmail());
}
markupDocBuilder.paragraph(paragraphBuilder.toString(), true);
}
return markupDocBuilder;
}
示例3: convertContact
import io.swagger.models.Contact; //导入依赖的package包/类
private Contact convertContact(io.swagger.annotations.Contact contactAnnotation) {
Contact contact = new Contact();
contact.setName(contactAnnotation.name());
contact.setUrl(contactAnnotation.url());
contact.setEmail(contactAnnotation.email());
return contact;
}
示例4: init
import io.swagger.models.Contact; //导入依赖的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);
}
示例5: testVersionInfoComponent
import io.swagger.models.Contact; //导入依赖的package包/类
@Test
public void testVersionInfoComponent() throws URISyntaxException {
Contact contact = new Contact().name("TestName").email("[email protected]");
Swagger2MarkupConverter.Context context = createContext();
MarkupDocBuilder markupDocBuilder = context.createMarkupDocBuilder();
markupDocBuilder = new ContactInfoComponent(context).apply(markupDocBuilder, ContactInfoComponent.parameters(
contact, OverviewDocument.SECTION_TITLE_LEVEL));
markupDocBuilder.writeToFileWithoutExtension(outputDirectory, StandardCharsets.UTF_8);
Path expectedFile = getExpectedFile(COMPONENT_NAME);
DiffUtils.assertThatFileIsEqual(expectedFile, outputDirectory, getReportName(COMPONENT_NAME));
}
示例6: updateInfoFromConfig
import io.swagger.models.Contact; //导入依赖的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());
}
示例7: getResourceSwaggerJson
import io.swagger.models.Contact; //导入依赖的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 "";
}
}
示例8: from
import io.swagger.models.Contact; //导入依赖的package包/类
private Contact from(io.swagger.annotations.Contact contactAnnotation) {
Contact contact = new Contact()
.name(emptyToNull(contactAnnotation.name()))
.email(emptyToNull(contactAnnotation.email()))
.url(emptyToNull(contactAnnotation.url()));
if (contact.getName() == null && contact.getEmail() == null && contact.getUrl() == null) {
contact = null;
}
return contact;
}
示例9: parseCommon
import io.swagger.models.Contact; //导入依赖的package包/类
private static Swagger parseCommon(String requestUrl, Project project) {
Swagger swagger = new Swagger();
Contact contact = new Contact();
/*contact.setName("Convertigo Support");
contact.setEmail("[email protected]");
contact.setUrl("http://www.convertigo.com/#developers");*/
Info info = new Info();
info.setContact(contact);
info.setTitle("Convertigo REST API");
info.setDescription("Find here all deployed projects");
if (project != null) {
info.setDescription(project.getComment());
info.setVersion(project.getVersion());
}
List<Scheme> schemes = new ArrayList<Scheme>();
String host;
String basePath;
Matcher matcher = parseRequestUrl.matcher(requestUrl);
if (matcher.find()) {
schemes.add(matcher.group(1) == null ? Scheme.HTTP : Scheme.HTTPS);
host = matcher.group(2);
basePath = matcher.group(3);
} else {
String webAppPath = EnginePropertiesManager.getProperty(PropertyName.APPLICATION_SERVER_CONVERTIGO_URL);
int index = webAppPath.indexOf("://") + 3;
host = webAppPath.substring(index, webAppPath.indexOf('/', index));
basePath = webAppPath.substring(index + host.length()) + "/api";
schemes.add(Scheme.HTTP);
schemes.add(Scheme.HTTPS);
}
swagger.setInfo(info);
swagger.setSchemes(schemes);
swagger.setHost(host);
swagger.setBasePath(basePath);
swagger.setConsumes(Arrays.asList("multipart/form-data", MimeType.WwwForm.value(), MimeType.Json.value(), MimeType.Xml.value()));
swagger.setProduces(Arrays.asList(MimeType.Json.value(), MimeType.Xml.value()));
return swagger;
}
示例10: initSwagger
import io.swagger.models.Contact; //导入依赖的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);
}
示例11: parameters
import io.swagger.models.Contact; //导入依赖的package包/类
public static ContactInfoComponent.Parameters parameters(Contact contact,
int titleLevel) {
return new ContactInfoComponent.Parameters(contact, titleLevel);
}
示例12: Parameters
import io.swagger.models.Contact; //导入依赖的package包/类
public Parameters(Contact contact,
int titleLevel) {
this.contact = Validate.notNull(contact, "Contact must not be null");
this.titleLevel = titleLevel;
}