/** * 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(); }
/** {@inheritDoc} */ public Content seeTagOutput(Doc holder, SeeTag[] seeTags) { ContentBuilder body = new ContentBuilder(); if (seeTags.length > 0) { for (int i = 0; i < seeTags.length; ++i) { appendSeparatorIfNotEmpty(body); body.addContent(htmlWriter.seeTagToContent(seeTags[i])); } } if (holder.isField() && ((FieldDoc) holder).constantValue() != null && htmlWriter instanceof ClassWriterImpl) { // Automatically add link to constant values page for constant fields. appendSeparatorIfNotEmpty(body); DocPath constantsPath = htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES); String whichConstant = ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name(); DocLink link = constantsPath.fragment(whichConstant); body.addContent( htmlWriter.getHyperLink( link, new StringContent(configuration.getText("doclet.Constants_Summary")))); } if (holder.isClass() && ((ClassDoc) holder).isSerializable()) { // Automatically add link to serialized form page for serializable classes. if ((SerializedFormBuilder.serialInclude(holder) && SerializedFormBuilder.serialInclude(((ClassDoc) holder).containingPackage()))) { appendSeparatorIfNotEmpty(body); DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM); DocLink link = serialPath.fragment(((ClassDoc) holder).qualifiedName()); body.addContent( htmlWriter.getHyperLink( link, new StringContent(configuration.getText("doclet.Serialized_Form")))); } } if (body.isEmpty()) return body; ContentBuilder result = new ContentBuilder(); result.addContent( HtmlTree.DT( HtmlTree.SPAN( HtmlStyle.seeLabel, new StringContent(configuration.getText("doclet.See_Also"))))); result.addContent(HtmlTree.DD(body)); return result; }
public boolean isField() { return mDoc.isField(); }