private String buildThrowTag(ThrowsTag tag) { String result = ""; if (tag.exception() == null) { result = "<font class='tagInfo'>" + tag.exceptionName() + "</font>"; } else { String link = getItemLink(tag.exception()); if (link == null) { result = "<font class='tagInfo'>" + tag.exception().qualifiedName() + "</font>"; } else { result = "<a href='" + link + "'>" + tag.exceptionName() + "</a>"; } } result += " - " + tag.exceptionComment(); return result; }
public String getTagText(Tag tag) { if (tag.name().equals("@see")) { try { return docWriter.seeTagToString((SeeTag) tag); } catch (ClassCastException e) { System.err.println("Error bulding @see tag " + tag.name()); return tag.text(); } } else if (tag.name().equals("@param")) { return buildParamTagText((ParamTag) tag); } else if (tag.name().equals("@throws") || tag.name().equals("@exception")) { return buildThrowTag((ThrowsTag) tag); } return tag.text(); }
/** * Returns the XML for the specified exceptions using the throws tags for additional description. * * @param exceptions exceptions instances to process * @param tags corresponding throws tags (not necessarily in the same order) * * @return the XML for the specified parameters using the param tags for additional description. */ private static XMLNode toExceptionsNode(ClassDoc[] exceptions, ThrowsTag[] tags) { if (exceptions.length == 0) return null; // Iterate over the exceptions XMLNode node = new XMLNode("exceptions"); for (ClassDoc exception : exceptions) { XMLNode n = toExceptionNode(exception, find(tags, exception.name())); node.child(n); } return node; }
/** * Returns the XML for an exception and its corresponding throws tag. * * @return The corresponding XML. */ private static XMLNode toExceptionNode(ClassDoc exception, ThrowsTag tag) { if (exception == null) return null; XMLNode node = new XMLNode("exception"); node.attribute("type", exception.typeName()); node.attribute("fulltype", exception.qualifiedTypeName()); if (tag != null) { node.attribute("comment", tag.exceptionComment()); node.text(toComment(tag)); } return node; }
/** * Find the corresponding throws tag * * @return */ private static ThrowsTag find(ThrowsTag[] tags, String name){ for (ThrowsTag tag : tags) { if (tag.exceptionName().equalsIgnoreCase(name)) return tag; } return null; }
/** * @return full JSON objects for the given ThrowsTag[] */ protected JSONArray processThrowsTags(ThrowsTag[] throwsTags) { JSONArray retMe = new JSONArray(); for (ThrowsTag throwsTag : throwsTags) { retMe.add(processThrowsTag(throwsTag)); } return retMe; }
/** * @return the full JSON for the given ThrowsTag */ protected JSONObject processThrowsTag(ThrowsTag throwsTag) { if (throwsTag == null) { return null; } JSONObject retMe = processTag(throwsTag); retMe.put("exceptionComment", throwsTag.exceptionComment()); retMe.put("exceptionName", throwsTag.exceptionName()); retMe.put("exceptionType", processTypeStub(throwsTag.exceptionType())); return retMe; }
/** * Returns the XML for the specified exceptions using the throws tags for additional description. * * @param exceptions exceptions instances to process * @param tags corresponding throws tags (not necessarily in the same order) * * @return the XML for the specified parameters using the param tags for additional description. */ private static XMLNode toExceptionsNode(Type[] exceptions, ThrowsTag[] tags) { if (exceptions.length == 0) return null; // Iterate over the exceptions XMLNode node = new XMLNode("exceptions"); for (Type exception : exceptions) { XMLNode n = toExceptionNode(exception, find(tags, exception.typeName())); node.child(n); } return node; }
/** * Returns the XML for an exception and its corresponding throws tag. * * @return The corresponding XML. */ private static XMLNode toExceptionNode(Type exception, ThrowsTag tag) { if (exception == null) return null; XMLNode node = new XMLNode("exception"); node.attribute("type", exception.typeName()); node.attribute("fulltype", exception.qualifiedTypeName()); if (tag != null) { node.attribute("comment", tag.exceptionComment()); node.text(toComment(tag)); } return node; }
/** * Find the corresponding throws tag * * @return */ private static ThrowsTag find(ThrowsTag[] tags, String name){ for (ThrowsTag tag : tags) { if (tag.exceptionName().equalsIgnoreCase(name)) { return tag; } } return null; }
@Override public void render(ThrowsTag tag, StringBuilder target, MarkdownDoclet doclet) { target.append(tag.name()) .append(' ').append(tag.exceptionName()) .append(' ').append(TagRendering.simplifySingleParagraph(doclet.toHtml(tag.exceptionComment()))); }