/** * Adds a syntax to the syntaxsection * * @param doc, doc item that has to be add to the syntax section */ void addSyntax(Doc doc) { if (doc.isConstructor() || doc.isMethod()) { StringBuffer syntaxBuffer = new StringBuffer(); for (Parameter parameter : ((ExecutableMemberDoc) doc).parameters()) { syntaxBuffer.append(parameter.typeName() + " " + parameter.name()); syntaxBuffer.append(", "); } if (syntaxBuffer.length() > 2) { syntaxBuffer.delete(syntaxBuffer.length() - 2, syntaxBuffer.length()); } String returnType = ""; if (doc.isMethod()) { MethodDoc methodDoc = (MethodDoc) doc; returnType = methodDoc.returnType().toString(); int lastDot = returnType.lastIndexOf('.'); if (lastDot != -1) { returnType = returnType.substring(lastDot + 1); } returnType += " "; } if (doc.isConstructor()) { addSyntax("<em>" + doc.commentText() + "</em>"); } addSyntax(returnType + doc.name() + "(" + syntaxBuffer.toString() + ")"); } else if (doc.isField()) { FieldDoc fieldDoc = (FieldDoc) doc; addSyntax(fieldDoc.type().typeName() + " " + doc.name()); } }
/** * Build the filename for a doc object and returns it * * @param doc * @param className * @return */ String buildFileName(Doc doc, String className) { String type; if (doc.isMethod()) { type = "_method_"; } else if (doc.isClass()) { type = "_class_"; } else if (doc.isField()) { type = "_field_"; } else { type = "_"; } return className.toLowerCase() + type + doc.name().toLowerCase(); }
/** * Adds all parameters of an executable doc member to the documentation * * @param doc */ void addParameters(Doc doc) { if (doc.isConstructor() || doc.isMethod()) { ExecutableMemberDoc memberDoc = (ExecutableMemberDoc) doc; ParamTag[] tags = memberDoc.paramTags(); for (int i = 0; i < tags.length; ++i) { addParameter(tags[i].parameterName(), tags[i].parameterComment()); } if (tags.length > 0) { memberParameters.insertTagContent(PARAMETER_TAG); PARAMETERS_TAG.setContent(memberParameters.getTemplateContent()); } } }
public boolean isMethod() { return mDoc.isMethod(); }