本文整理了Java中io.swagger.models.Tag.getName()
方法的一些代码示例,展示了Tag.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.getName()
方法的具体详情如下:
包路径:io.swagger.models.Tag
类名称:Tag
方法名:getName
暂无
代码示例来源:origin: Swagger2Markup/swagger2markup
private String mapToString(Tag tag) {
String name = tag.getName();
String description = tag.getDescription();
if (isNotBlank(description)) {
return name + COLON + description;
} else {
return name;
}
}
代码示例来源:origin: Swagger2Markup/swagger2markup
/**
* Converts the global Tag list into a Map where the tag name is the key and the Tag the value.
* Either ordered or as-is, if the comparator is null.
*
* @param tags the List of tags
* @param comparator the comparator to use.
* @return the Map of tags. Either ordered or as-is, if the comparator is null.
*/
public static Map<String, Tag> toSortedMap(List<Tag> tags, Comparator<String> comparator) {
Map<String, Tag> sortedMap;
if (comparator == null)
sortedMap = new LinkedHashMap<>();
else
sortedMap = new TreeMap<>(comparator);
tags.forEach(tag -> sortedMap.put(tag.getName(), tag));
return sortedMap;
}
代码示例来源:origin: jooby-project/jooby
private String operationId(RouteMethod route, Tag tag, Map<String, Integer> opIds) {
String operationId = stringAttribute(route, "nickname");
if (operationId == null) {
operationId = route.name().orElseGet(() -> {
String args = "";
if (route.method().equals("GET") && route.parameters().size() > 0) {
args = route.parameters().stream()
.filter(p -> p.kind() == RouteParameter.Kind.QUERY
|| p.kind() == RouteParameter.Kind.PATH)
.map(p -> p.name())
.map(this::ucase)
.reduce(new StringBuilder("By"), StringBuilder::append, StringBuilder::append)
.toString();
}
return route.method().toLowerCase() + ucase(tag.getName().replace("/", "")) + args;
});
}
int c = opIds.getOrDefault(operationId, 0);
opIds.put(operationId, c + 1);
if (c == 0) {
return operationId;
}
return operationId + c;
}
代码示例来源:origin: jooby-project/jooby
.filter(it -> it != null && it.trim().length() > 0)
.map(tagFactory)
.forEach(tag -> op.addTag(tag.getName()));
break;
case "response":
代码示例来源:origin: jooby-project/jooby
tags.forEach(it -> op.addTag(it.getName()));
代码示例来源:origin: kongchen/swagger-maven-plugin
protected Map<String, Tag> updateTagsForApi(Map<String, Tag> parentTags, Api api) {
// the value will be used as a tag for 2.0 UNLESS a Tags annotation is present
Map<String, Tag> tagsMap = new HashMap<>();
for (Tag tag : extractTags(api)) {
tagsMap.put(tag.getName(), tag);
}
if (parentTags != null) {
tagsMap.putAll(parentTags);
}
for (Tag tag : tagsMap.values()) {
swagger.tag(tag);
}
return tagsMap;
}
代码示例来源:origin: kongchen/swagger-maven-plugin
private void updateTagDescriptions(Map<String, Tag> discoveredTags) {
if (swagger.getTags() != null) {
for (Tag tag : swagger.getTags()) {
Tag rightTag = discoveredTags.get(tag.getName());
if (rightTag != null && rightTag.getDescription() != null) {
tag.setDescription(rightTag.getDescription());
}
}
}
}
代码示例来源:origin: stackoverflow.com
final JLabel label = new JLabel(tag.getName());
label.setOpaque(false);
label.setFont(label.getFont().deriveFont((float) tag.getWeight() * 10));
代码示例来源:origin: apache/cxf
@Override
public int compare(final Tag tag1, final Tag tag2) {
return tag1.getName().compareTo(tag2.getName());
}
});
代码示例来源:origin: io.swagger/swagger-models
public Tag getTag(String tagName) {
Tag tag = null;
if (this.tags != null && tagName != null) {
for (Tag existing : this.tags) {
if (existing.getName().equals(tagName)) {
tag = existing;
break;
}
}
}
return tag;
}
代码示例来源:origin: stackoverflow.com
@RequestMapping(value = "/getTags", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody List<Tag> getTags(@RequestBody Tag tag, HttpServletResponse response) {
System.out.println("Found " + String.valueOf(tagService.findTagByName(tag.getName()).size()));
return tagService.findTagByName(tag.getName());
}
代码示例来源:origin: io.swagger/swagger-models
public void addTag(Tag tag) {
if (this.tags == null) {
this.tags = new ArrayList<Tag>();
}
if (tag != null && tag.getName() != null) {
if (getTag(tag.getName()) == null) {
this.tags.add(tag);
}
}
}
代码示例来源:origin: stackoverflow.com
private static final Map<String, Tag> TAG_LOOKUP_MAP;
static {
for (Field field: Tag.class.getFields()) {
if (Modifier.isPublic(field.getModifiers()) &&
Modifier.isStatic(field.getModifiers()) &&
Modifier.isFinal(field.getModifiers()) {
Tag tag = (Tag) field.get(null);
TAG_LOOKUP_MAP.put(tag.getName(), tag);
}
}
}
代码示例来源:origin: stackoverflow.com
public void onChangeSelectedTags() {
StringBuilder stringBuilder = new StringBuilder();
for (CharSequence tag : selectedTags)
stringBuilder.append(tag + ",");
Tag tmp_tag = null;
for (int i=0;i<et.length;i++) {
tmp_tag = (Tag) et[i].getTag();
// Toast.makeText(getBaseContext(), e.getText()+"",
// Toast.LENGTH_SHORT).show();
if (tmp_tag.getName().equals("Tags")) {
e.setText(stringBuilder.toString());
}
}
}
代码示例来源:origin: com.reprezen.genflow/swagger-doc
public Tag getModelTag(final String tagName) {
List<Tag> _tags = this.swagger.getTags();
for (final Tag tag : _tags) {
String _name = tag.getName();
boolean _equals = Objects.equal(_name, tagName);
if (_equals) {
return tag;
}
}
return null;
}
}
代码示例来源:origin: io.github.swagger2markup/swagger2markup
private String mapToString(Tag tag) {
String name = tag.getName();
String description = tag.getDescription();
if (isNotBlank(description)) {
return name + COLON + description;
} else {
return name;
}
}
代码示例来源:origin: stackoverflow.com
public List<Tag> filterTags(List<Tag> tags) {
Criteria criteria = session.createCriteria(Tag.class);
Disjunction disjunction = Restrictions.disjunction();
for (Tag tag : tags) {
disjunction.add(Restrictions.eq("name", tag.getName()));
}
criteria.add(disjunction);
return criteria.list();
}
代码示例来源:origin: io.swagger/swagger-models
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("Tag {\n");
b.append("\tname: ").append(getName()).append("\n");
b.append("\tdescription: ").append(getDescription()).append("\n");
b.append("\texternalDocs: ").append(getExternalDocs()).append("\n");
b.append("\textensions:").append(vendorExtensions.toString());
b.append("}");
return b.toString();
}
代码示例来源:origin: com.vmware.xenon/xenon-swagger
private io.swagger.models.Operation opCreateInstance(ServiceDocument doc) {
io.swagger.models.Operation op = new io.swagger.models.Operation();
op.addTag(this.currentTag.getName());
op.setParameters(Collections.singletonList(paramBody(doc)));
op.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(doc)
));
return op;
}
代码示例来源:origin: com.vmware.xenon/xenon-swagger
private io.swagger.models.Operation opDefault(ServiceDocument doc) {
io.swagger.models.Operation op = new io.swagger.models.Operation();
op.addTag(this.currentTag.getName());
op.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(doc),
Operation.STATUS_CODE_NOT_FOUND, responseGenericError()
));
return op;
}
内容来源于网络,如有侵权,请联系作者删除!