private String mapToString(Tag tag) { String name = tag.getName(); String description = tag.getDescription(); if (isNotBlank(description)) { return name + COLON + description; } else { return name; } }
/** * 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; }
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; }
.filter(it -> it != null && it.trim().length() > 0) .map(tagFactory) .forEach(tag -> op.addTag(tag.getName())); break; case "response":
tags.forEach(it -> op.addTag(it.getName()));
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; }
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()); } } } }
final JLabel label = new JLabel(tag.getName()); label.setOpaque(false); label.setFont(label.getFont().deriveFont((float) tag.getWeight() * 10));
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; }
@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()); }
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); } } }
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()); } } }
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; } }
private String mapToString(Tag tag) { String name = tag.getName(); String description = tag.getDescription(); if (isNotBlank(description)) { return name + COLON + description; } else { return name; } }
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(); }
@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(); }
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; }
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; }