public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{\"id\":" + getId() + ","); stringBuilder.append("\"name\":\"" + StringUtils.escapeInJ(getName()) + "\","); stringBuilder.append("\"description\":\"" + StringUtils.escapeInJ(getDescription()) + "\","); stringBuilder.append("\"requestType\":\"" + getRequestType() + "\","); stringBuilder.append("\"requestUrl\":\"" + StringUtils.escapeInJ(getRequestUrl()) + "\","); stringBuilder.append( "\"responseTemplate\":\"" + StringUtils.escapeInJ(getResponseTemplate()) + "\","); stringBuilder.append("\"requestParameterList\":"); stringBuilder.append("["); Iterator<Parameter> iterator = getRequestParameterListOrdered().iterator(); while (iterator.hasNext()) { stringBuilder.append(iterator.next()); if (iterator.hasNext()) { stringBuilder.append(","); } } stringBuilder.append("],"); stringBuilder.append("\"responseParameterList\":"); stringBuilder.append("["); iterator = getResponseParameterListOrdered().iterator(); while (iterator.hasNext()) { stringBuilder.append(iterator.next()); if (iterator.hasNext()) { stringBuilder.append(","); } } stringBuilder.append("]}"); return stringBuilder.toString(); }
private void getCommonModelHTMLSub(StringBuilder html, List<CommonModelField> list, short level) { for (CommonModelField f : list) { html // .append("<tr class=\"tr-level-" + level + "\">") // .append("<td class=\"td-name\">" + levelMark(level) + // StringUtils.escapeInH(p.getName()) + "</td>") .append( "<td class=\"td-identifier\">" + StringUtils.escapeInH(f.getIdentifier()) + "</td>") .append("<td class=\"td-type\">" + StringUtils.escapeInH(f.getDatatype()) + "</td>") // .append("<td class=\"td-need\">" + StringUtils.escapeInH(f.getNeeded()) + "</td>") .append("<td class=\"td-need\">" + (f.getNeeded() == 1 ? "是" : "否") + "</td>") .append("<td class=\"td-remark\">" + StringUtils.escapeInH(f.getDescription()) + "</td>") .append("</tr>"); /*if (p.getParameterList() != null || p.getParameterList().size() > 0) { getParameterListHTMLSub(html, p.getParameterList(), (short)(level + 1)); }*/ } }
private void getParameterListHTMLSub(StringBuilder html, Set<Parameter> list, short level) { for (Parameter p : list) { html.append("<tr class=\"tr-level-" + level + "\">") .append( "<td class=\"td-name\">" + levelMark(level) + StringUtils.escapeInH(p.getName()) + "</td>") .append( "<td class=\"td-identifier\">" + StringUtils.escapeInH(p.getIdentifier()) + "</td>") .append("<td class=\"td-type\">" + StringUtils.escapeInH(p.getDataType()) + "</td>") .append("<td class=\"td-remark\">" + StringUtils.escapeInH(p.getRemark()) + "</td>") .append("</tr>"); if (p.getParameterList() != null || p.getParameterList().size() > 0) { getParameterListHTMLSub(html, p.getParameterList(), (short) (level + 1)); } } }
public String toString(TO_STRING_TYPE type) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{\"createDateStr\":\"" + getCreateDateStr() + "\","); stringBuilder.append("\"user\":" + getUser() + ","); stringBuilder.append("\"id\":" + getId() + ","); stringBuilder.append("\"version\":\"" + getVersion() + "\","); stringBuilder.append("\"introduction\":\"" + StringUtils.escapeInJ(getIntroduction()) + "\","); stringBuilder.append("\"name\":\"" + StringUtils.escapeInJ(getName()) + "\","); stringBuilder.append("\"moduleList\":"); stringBuilder.append("["); Iterator<Module> iterator = getModuleListOrdered().iterator(); while (iterator.hasNext()) { stringBuilder.append(iterator.next().toString(type)); if (iterator.hasNext()) { stringBuilder.append(","); } } stringBuilder.append("]}"); return stringBuilder.toString(); }