methodDocType.setMethodName(methodDoc.name()); methodDocType.setMethodSignature(methodDoc.signature()); methodDocType.setCommentText(methodDoc.commentText()); docProcessor.processMethodDoc(methodDoc, methodDocType);
/** * Summarizes the test methods of the given class */ public static void document(ClassDoc c, PrintWriter pw) throws IOException { pw.println(c.qualifiedName()); { String comment = c.commentText(); if (comment != null && !comment.equals("")) { pw.println(""); indent(comment, 4, pw); pw.println(""); } } MethodDoc[] methods = getTestMethods(c); for (int i = 0; i < methods.length; i++) { MethodDoc method = methods[i]; pw.print(" "); pw.println(method.name()); String comment = method.commentText(); if (comment != null && !comment.equals("")) { pw.println(""); indent(comment, 6, pw); pw.println(""); } } pw.println(""); }
public class ExtractCommentsDoclet { public static boolean start(RootDoc root) throws IOException { for (ClassDoc c : root.classes()) { print(c.qualifiedName(), c.commentText()); for (FieldDoc f : c.fields(false)) { print(f.qualifiedName(), f.commentText()); } for (MethodDoc m : c.methods(false)) { print(m.qualifiedName(), m.commentText()); if (m.commentText() != null && m.commentText().length() > 0) { for (ParamTag p : m.paramTags()) print(m.qualifiedName() + "@" + p.parameterName(), p.parameterComment()); for (Tag t : m.tags("return")) { if (t.text() != null && t.text().length() > 0) print(m.qualifiedName() + "@return", t.text()); } } } } return true; } private static void print(String name, String comment) throws IOException { if (comment != null && comment.length() > 0) { new FileWriter(name + ".txt").append(comment).close(); } } }
@Override public String getMethodDoc(Method method) { final MethodDoc doc = _doclet.getMethodDoc(method); if (doc == null) { return null; } return buildDoc(doc.commentText()); }
/** * Summarizes the test methods of the given class */ public static void document(ClassDoc c, PrintWriter pw) throws IOException { pw.println(c.qualifiedName()); { String comment = c.commentText(); if (comment != null && !comment.equals("")) { pw.println(""); indent(comment, 4, pw); pw.println(""); } } MethodDoc[] methods = getTestMethods(c); for (int i = 0; i < methods.length; i++) { MethodDoc method = methods[i]; pw.print(" "); pw.println(method.name()); String comment = method.commentText(); if (comment != null && !comment.equals("")) { pw.println(""); indent(comment, 6, pw); pw.println(""); } } pw.println(""); }
public static MethodDocumentation fromMethodDoc(MethodDoc methodDoc) { MethodDocumentation md = new MethodDocumentation(); md.comment = methodDoc.commentText(); for (Tag tag : methodDoc.tags()) { if (tag instanceof ParamTag) { ParamTag paramTag = (ParamTag) tag; md.parameters.put(paramTag.parameterName(), paramTag.parameterComment()); } else { md.tags.put(cleanupTagName(tag.name()), tag.text()); } } return md; } }
public static boolean start(RootDoc root) throws IOException { String dumpFileName = readOptions(root.options()); OutputStream os = Files.newOutputStream(Paths.get(dumpFileName)); Properties javaDocMap = new Properties(); for (ClassDoc classDoc : root.classes()) { javaDocMap.put(classDoc.toString(), classDoc.commentText()); for (MethodDoc method : classDoc.methods()) { javaDocMap.put(method.qualifiedName(), method.commentText()); for (ParamTag paramTag : method.paramTags()) { Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; ++i) { if (parameters[i].name().equals(paramTag.parameterName())) { javaDocMap.put(method.qualifiedName() + ".paramCommentTag." + i, paramTag.parameterComment()); } } } Tag[] retTags = method.tags("return"); if (retTags != null && retTags.length == 1) { Tag retTag = method.tags("return")[0]; javaDocMap.put(method.qualifiedName() + "." + "returnCommentTag", retTag.text()); } } } javaDocMap.store(os, ""); os.flush(); os.close(); return true; }
protected ApiElement printMethod(MethodDoc method) throws IOException { ApiElement element = new ApiElement(); element.setCaption(String.format("%s(%s)", method.name(), parameters(method.parameters()))); element.setContent(String.format("%s(%s)", method.name(), placeholders(method.parameters()))); StringBuilder sb = new StringBuilder(); String comment = !method.commentText().isEmpty() ? removeImagesTags(method.commentText().replaceAll("[\\n]+", "\n")) + "\n" : ""; sb.append(comment); if (method.paramTags().length > 0) { sb.append("<table>"); sb.append("<tr><th>Parameter</th> <th>Description</th></tr>"); for (ParamTag param : method.paramTags()) { sb.append(String.format("<tr> <th> %s </th> <th> %s </th></tr>", param.parameterName(), asMarkdown(param.parameterComment()))); } sb.append("</table>"); } for (Tag t : method.tags("return")) { String text = t.text(); if (text != null) { sb.append(String.format("-<strong>returns:</strong> %s \n", asMarkdown(text))); } } for (Tag t : method.tags("see")) { String text = t.text(); if (text != null) { sb.append(String.format("-<strong>see:</strong> %s \n", asMarkdown(text))); } } element.setDescription(sb.toString()); return element; }
public static boolean start(RootDoc root) throws IOException { String dumpFileName = readOptions(root.options()); OutputStream os = Files.newOutputStream(Paths.get(dumpFileName)); Properties javaDocMap = new Properties(); for (ClassDoc classDoc : root.classes()) { javaDocMap.put(classDoc.toString(), classDoc.commentText()); for (MethodDoc method : classDoc.methods()) { javaDocMap.put(method.qualifiedName(), method.commentText()); for (ParamTag paramTag : method.paramTags()) { Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; ++i) { if (parameters[i].name().equals(paramTag.parameterName())) { javaDocMap.put(method.qualifiedName() + ".paramCommentTag." + i, paramTag.parameterComment()); } } } Tag[] retTags = method.tags("return"); if (retTags != null && retTags.length == 1) { Tag retTag = method.tags("return")[0]; javaDocMap.put(method.qualifiedName() + "." + "returnCommentTag", retTag.text()); } } } javaDocMap.store(os, ""); os.flush(); os.close(); return true; }
if (null != accessor && !Strings.isNullOrEmpty(accessor.commentText()))
methodDocType.setCommentText( methodDoc.commentText() ); docProcessor.processMethodDoc( methodDoc, methodDocType );
expression.setDescription(md.commentText().replaceAll("\n", " "));
apiDoc.setMapping(mapping); apiDoc.setCategory(category.getCid()); apiDoc.setDesc(methodDoc.commentText()); tagName = getTagText(methodDoc, "summary", true); apiDoc.setName(StringUtils.isEmpty(tagName) ? methodDoc.commentText() : tagName); apiDoc.setAuthor(getTagText(methodDoc, "author", false)); apiDoc.setVersion(getTagText(methodDoc, "version", false));
trace.trace(classDoc.name() + " > " + methodDoc.qualifiedName() + " > " + annotationDesc.annotationType().name()); trace.trace(asList(annotationDesc.elementValues()).toString()); trace.trace(methodDoc.commentText()); .setNotes(methodDoc.commentText());
String comment = methodDoc.commentText(); if (comment.length() > 0) { methodNode.setComment(comment);
protected void printMarkDown(MethodDoc method) throws IOException { appendNewline("## `.%s(%s)`", method.name(), parameters(method.parameters())); appendNewline(); appendNewline(asMarkdown(method.commentText())); appendNewline(); if (method.paramTags().length > 0) { appendNewline("Parameter | Description"); appendNewline("--------- | -----------"); for (ParamTag param : method.paramTags()) { appendNewline("%s | %s", param.parameterName(), asMarkdown(param.parameterComment())); } appendNewline(); } for (Tag t : method.tags("return")) { String text = t.text(); if (text != null) { appendNewline("- **returns:** %s", asMarkdown(text)); } } for (Tag t : method.tags("see")) { String text = t.text(); if (text != null) { appendNewline("- **see:** %s", asMarkdown(text)); } } appendNewline(); }
result.setQuery( false ); // assume the method is not read-only factory.constructTagDocumentation( result, doc.commentText() );