本文整理了Java中io.swagger.models.Tag.setName()
方法的一些代码示例,展示了Tag.setName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.setName()
方法的具体详情如下:
包路径:io.swagger.models.Tag
类名称:Tag
方法名:setName
暂无
代码示例来源:origin: apache/servicecomb-java-chassis
private Tag convertTag(io.swagger.annotations.Tag tagAnnotation) {
Tag tag = new Tag();
tag.setName(tagAnnotation.name());
tag.setDescription(tagAnnotation.description());
tag.setExternalDocs(convertExternalDocs(tagAnnotation.externalDocs()));
tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagAnnotation.extensions()));
return tag;
}
代码示例来源:origin: io.swagger/swagger-models
public Tag name(String name) {
setName(name);
return this;
}
代码示例来源:origin: com.github.phillip-kruger/apiee-core
private List<Tag> toTagList(List<Tag> original,String tags) {
List<Tag> tagList = new ArrayList<>();
for(String tag:toList(tags)){
Tag t = new Tag();
if(tag.contains(DOUBLE_POINT)){
String[] nameAndDesc = tag.split(DOUBLE_POINT);
t.setName(nameAndDesc[0]);
t.setDescription(nameAndDesc[1]);
}else{
t.setName(tag);
}
tagList.add(t);
}
if(original!=null){
original.addAll(tagList);
return original;
}else{
return tagList;
}
}
代码示例来源:origin: com.gitblit.fathom/fathom-rest-swagger
/**
* Returns the tag of the model.
* This ref is either explicitly named or it is generated from the model class name.
*
* @param modelClass
* @return the tag of the model
*/
protected Tag getModelTag(Class<?> modelClass) {
if (modelClass.isAnnotationPresent(ApiModel.class)) {
ApiModel annotation = modelClass.getAnnotation(ApiModel.class);
Tag tag = new Tag();
tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.name())).or(modelClass.getSimpleName()));
tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
return tag;
}
Tag tag = new Tag();
tag.setName(modelClass.getName());
return tag;
}
代码示例来源:origin: gitblit/fathom
/**
* Returns the tag of the model.
* This ref is either explicitly named or it is generated from the model class name.
*
* @param modelClass
* @return the tag of the model
*/
protected Tag getModelTag(Class<?> modelClass) {
if (modelClass.isAnnotationPresent(ApiModel.class)) {
ApiModel annotation = modelClass.getAnnotation(ApiModel.class);
Tag tag = new Tag();
tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.name())).or(modelClass.getSimpleName()));
tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
return tag;
}
Tag tag = new Tag();
tag.setName(modelClass.getName());
return tag;
}
代码示例来源:origin: SciGraph/SciGraph
private byte[] writeDynamicResource(InputStream is) throws IOException {
String str = CharStreams.toString(new InputStreamReader(is, Charsets.UTF_8));
Swagger swagger = new SwaggerParser().parse(str);
// set the resource listing tag
Tag dynamic = new Tag();
dynamic.setName("dynamic");
dynamic.setDescription("Dynamic Cypher resources");
swagger.addTag(dynamic);
// add resources to the path
Map<String,Path> paths = swagger.getPaths();
paths.putAll(configuration.getCypherResources());
Map<String,Path> sorted = new LinkedHashMap<>();
List<String> keys = new ArrayList<>();
keys.addAll(paths.keySet());
Collections.sort(keys);
for (String key : keys) {
sorted.put(key, paths.get(key));
}
swagger.setPaths(sorted);
// return updated swagger JSON
return Json.pretty(swagger).getBytes();
}
代码示例来源:origin: org.ballerinalang/ballerina-to-swagger
/**
* Creates tag swagger definition.
*
* @param annotationExpression The ballerina annotation attribute value for tag.
* @param swagger The swagger definition which the tags needs to be build on.
*/
private void createTagModel(BLangExpression annotationExpression, Swagger swagger) {
if (null != annotationExpression) {
List<Tag> tags = new LinkedList<>();
BLangArrayLiteral tagArray = (BLangArrayLiteral) annotationExpression;
for (ExpressionNode expr : tagArray.getExpressions()) {
List<BLangRecordKeyValue> tagList = ((BLangRecordLiteral) expr).getKeyValuePairs();
Map<String, BLangExpression> tagAttributes = ConverterUtils.listToMap(tagList);
Tag tag = new Tag();
if (tagAttributes.containsKey(ConverterConstants.ATTR_NAME)) {
tag.setName(ConverterUtils.getStringLiteralValue(tagAttributes.get(ConverterConstants.ATTR_NAME)));
}
if (tagAttributes.containsKey(ConverterConstants.ATTR_DESCRIPTION)) {
tag.setDescription(ConverterUtils
.getStringLiteralValue(tagAttributes.get(ConverterConstants.ATTR_DESCRIPTION)));
}
tags.add(tag);
}
swagger.setTags(Lists.reverse(tags));
}
}
代码示例来源:origin: gitblit/fathom
/**
* Returns the Tag for a controller.
*
* @param controllerClass
* @return a controller tag or null
*/
protected Tag getControllerTag(Class<? extends Controller> controllerClass) {
if (controllerClass.isAnnotationPresent(ApiOperations.class)) {
ApiOperations annotation = controllerClass.getAnnotation(ApiOperations.class);
io.swagger.models.Tag tag = new io.swagger.models.Tag();
tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.tag())).or(controllerClass.getSimpleName()));
tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
if (!Strings.isNullOrEmpty(annotation.externalDocs())) {
ExternalDocs docs = new ExternalDocs();
docs.setUrl(annotation.externalDocs());
tag.setExternalDocs(docs);
}
if (!Strings.isNullOrEmpty(tag.getDescription())) {
return tag;
}
}
return null;
}
代码示例来源:origin: com.gitblit.fathom/fathom-rest-swagger
/**
* Returns the Tag for a controller.
*
* @param controllerClass
* @return a controller tag or null
*/
protected Tag getControllerTag(Class<? extends Controller> controllerClass) {
if (controllerClass.isAnnotationPresent(ApiOperations.class)) {
ApiOperations annotation = controllerClass.getAnnotation(ApiOperations.class);
io.swagger.models.Tag tag = new io.swagger.models.Tag();
tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.tag())).or(controllerClass.getSimpleName()));
tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
if (!Strings.isNullOrEmpty(annotation.externalDocs())) {
ExternalDocs docs = new ExternalDocs();
docs.setUrl(annotation.externalDocs());
tag.setExternalDocs(docs);
}
if (!Strings.isNullOrEmpty(tag.getDescription())) {
return tag;
}
}
return null;
}
代码示例来源:origin: com.vmware.xenon/xenon-swagger
this.currentTag.setName(uri);
代码示例来源:origin: org.apache.servicecomb/swagger-generator-core
private Tag convertTag(io.swagger.annotations.Tag tagAnnotation) {
Tag tag = new Tag();
tag.setName(tagAnnotation.name());
tag.setDescription(tagAnnotation.description());
tag.setExternalDocs(convertExternalDocs(tagAnnotation.externalDocs()));
tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagAnnotation.extensions()));
return tag;
}
代码示例来源:origin: apache/cxf
tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_"));
if (javadocProvider != null) {
tag.setDescription(javadocProvider.getClassDoc(cri));
代码示例来源:origin: com.reprezen.genflow/rapidml-swagger
final Consumer<com.reprezen.rapidml.Extension> _function_1 = (com.reprezen.rapidml.Extension it) -> {
final Tag tag = new Tag();
tag.setName(it.getName().substring(13));
final String description = it.getValue();
tag.setDescription(description);
final Consumer<ResourceDefinition> _function_4 = (ResourceDefinition it) -> {
final Tag tag = new Tag();
tag.setName(it.getName());
tag.setDescription(this._zenModelHelper.getDocumentation(it));
swagger.addTag(tag);
代码示例来源:origin: org.wso2.msf4j/msf4j-swagger
if (!tagConfig.name().isEmpty()) {
Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());
代码示例来源:origin: wso2/msf4j
if (!tagConfig.name().isEmpty()) {
Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());
代码示例来源:origin: io.swagger/swagger-jaxrs
if (!tagConfig.name().isEmpty()) {
Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());
代码示例来源:origin: Sayi/swagger-dubbo
if (StringUtils.isNotBlank(tagConfig.name())) {
final Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());
代码示例来源:origin: noboomu/proteus
if (!tagConfig.name().isEmpty()) {
Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());
代码示例来源:origin: javagossip/dorado
if (!tagConfig.name().isEmpty()) {
Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());
内容来源于网络,如有侵权,请联系作者删除!