final DocProcessor docProcessor) { final Parameter[] parameters = methodDoc.parameters(); final ParamTag[] paramTags = methodDoc.paramTags();
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(); } } }
public boolean isCorrectMethod(MethodDoc method) { return method.paramTags().length + method.tags("return").length + method.throwsTags().length + method.seeTags().length > 0; } }
public boolean isCorrectMethod(MethodDoc method) { return method.paramTags().length + method.tags("return").length + method.throwsTags().length + method.seeTags().length > 0; } }
@Override public String getParamDoc(Method method, String name) { final MethodDoc methodDoc = _doclet.getMethodDoc(method); if (methodDoc != null) { for (ParamTag tag: methodDoc.paramTags()) { if (name.equals(tag.parameterName())) { return buildDoc(tag.parameterComment()); } } } return null; }
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; }
resource = new Resource(clazz.qualifiedName()); ParamTag[] paramTags = method.paramTags(); for (Parameter parameter : method.parameters()) { Type type = parameter.type();
resource = new Resource(clazz.qualifiedName()); ParamTag[] paramTags = method.paramTags(); for (Parameter parameter : method.parameters()) { Type type = parameter.type();
resource = new Resource(clazz.qualifiedName()); ParamTag[] paramTags = method.paramTags(); for (Parameter parameter : method.parameters()) { Type type = parameter.type();
private static void addParamDocs( MethodDoc methodDoc, final MethodDocType methodDocType, final DocProcessor docProcessor ) { final ParamTag[] paramTags = methodDoc.paramTags();
input.method.typeParamTags() : input.method.paramTags(); Map<String, String> rankMap = getRankMap(input.isTypeVariableParamTag ? (Object[]) input.method.typeParameters() :
((MethodDoc)input.element).typeParamTags() : ((MethodDoc)input.element).paramTags(); Map<String, String> rankMap = getRankMap(input.isTypeVariableParamTag ? (Object[]) ((MethodDoc)input.element).typeParameters() :
.setNotes(methodDoc.commentText()); for (ParamTag paramTag : methodDoc.paramTags()) { trace.trace("\t" + paramTag.parameterName() + " > " + paramTag.parameterComment());
public static void parameterDoc(ApiDoc apiDoc, ClassDoc classDoc, MethodDoc methodDoc) throws Exception { ParamTag[] paramTags = methodDoc.paramTags(); Method method = DocletUtil.getMethodByDoc(Class.forName(classDoc.qualifiedTypeName()), methodDoc); List<ApiParamMeta> apiArgMetas = ApiMetaResolver.getApiParamMetas(method);
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(); }
parameterTags = doc.paramTags();