private static String getAccept(Operation operation) { String accepts = null; String defaultContentType = "application/json"; if (operation.getProduces() != null && !operation.getProduces().isEmpty()) { StringBuilder sb = new StringBuilder(); for (String produces : operation.getProduces()) { if (defaultContentType.equalsIgnoreCase(produces)) { accepts = defaultContentType; break; } else { if (sb.length() > 0) { sb.append(","); } sb.append(produces); } } if (accepts == null) { accepts = sb.toString(); } } else { accepts = defaultContentType; } return accepts; }
private String joinStrings(String sep, List<String> ss) { StringBuilder sb = new StringBuilder(); for (String s : ss) { if (sb.length() > 0) { sb.append(sep); } sb.append(s); } return sb.toString(); }