src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java

Wed, 10 Oct 2012 16:48:21 -0700

author
jjg
date
Wed, 10 Oct 2012 16:48:21 -0700
changeset 1359
25e14ad23cef
parent 1357
c75be5bc5283
child 1365
2013982bee34
permissions
-rw-r--r--

8000665: fix "internal API" comments on javadoc files
Reviewed-by: darcy

duke@1 1 /*
jjg@1357 2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.formats.html;
duke@1 27
bpatel@233 28 import com.sun.javadoc.*;
jjg@1357 29 import com.sun.tools.doclets.formats.html.markup.*;
duke@1 30 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 31 import com.sun.tools.doclets.internal.toolkit.taglets.*;
duke@1 32
duke@1 33 /**
duke@1 34 * Generate serialized form for Serializable/Externalizable methods.
duke@1 35 * Documentation denoted by the <code>serialData</code> tag is processed.
duke@1 36 *
jjg@1359 37 * <p><b>This is NOT part of any supported API.
jjg@1359 38 * If you write code that depends on this, you do so at your own risk.
jjg@1359 39 * This code and its internal interfaces are subject to change or
jjg@1359 40 * deletion without notice.</b>
jjg@1359 41 *
duke@1 42 * @author Joe Fialli
bpatel@766 43 * @author Bhavesh Patel (Modified)
duke@1 44 */
duke@1 45 public class HtmlSerialMethodWriter extends MethodWriterImpl implements
duke@1 46 SerializedFormWriter.SerialMethodWriter{
duke@1 47
duke@1 48 public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
duke@1 49 ClassDoc classdoc) {
duke@1 50 super(writer, classdoc);
duke@1 51 }
duke@1 52
bpatel@766 53 /**
bpatel@766 54 * Return the header for serializable methods section.
bpatel@766 55 *
bpatel@766 56 * @return a content tree for the header
bpatel@766 57 */
bpatel@766 58 public Content getSerializableMethodsHeader() {
bpatel@766 59 HtmlTree ul = new HtmlTree(HtmlTag.UL);
bpatel@766 60 ul.addStyle(HtmlStyle.blockList);
bpatel@766 61 return ul;
duke@1 62 }
duke@1 63
bpatel@766 64 /**
bpatel@766 65 * Return the header for serializable methods content section.
bpatel@766 66 *
bpatel@766 67 * @param isLastContent true if the cotent being documented is the last content.
bpatel@766 68 * @return a content tree for the header
bpatel@766 69 */
bpatel@766 70 public Content getMethodsContentHeader(boolean isLastContent) {
bpatel@766 71 HtmlTree li = new HtmlTree(HtmlTag.LI);
bpatel@766 72 if (isLastContent)
bpatel@766 73 li.addStyle(HtmlStyle.blockListLast);
bpatel@766 74 else
bpatel@766 75 li.addStyle(HtmlStyle.blockList);
bpatel@766 76 return li;
duke@1 77 }
duke@1 78
bpatel@766 79 /**
bpatel@766 80 * Add serializable methods.
bpatel@766 81 *
bpatel@766 82 * @param heading the heading for the section
bpatel@766 83 * @param serializableMethodContent the tree to be added to the serializable methods
bpatel@766 84 * content tree
bpatel@766 85 * @return a content tree for the serializable methods content
bpatel@766 86 */
bpatel@766 87 public Content getSerializableMethods(String heading, Content serializableMethodContent) {
bpatel@766 88 Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
bpatel@766 89 "serialized_methods"));
bpatel@766 90 Content headingContent = new StringContent(heading);
bpatel@766 91 Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
bpatel@766 92 headingContent);
bpatel@766 93 li.addContent(serialHeading);
bpatel@766 94 li.addContent(serializableMethodContent);
bpatel@766 95 return li;
duke@1 96 }
duke@1 97
bpatel@766 98 /**
bpatel@766 99 * Return the no customization message.
bpatel@766 100 *
bpatel@766 101 * @param msg the message to be displayed
bpatel@766 102 * @return no customization message content
bpatel@766 103 */
bpatel@766 104 public Content getNoCustomizationMsg(String msg) {
bpatel@766 105 Content noCustomizationMsg = new StringContent(msg);
bpatel@766 106 return noCustomizationMsg;
duke@1 107 }
duke@1 108
bpatel@766 109 /**
bpatel@766 110 * Add the member header.
bpatel@766 111 *
bpatel@766 112 * @param member the method document to be listed
bpatel@766 113 * @param methodsContentTree the content tree to which the member header will be added
bpatel@766 114 */
bpatel@766 115 public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
bpatel@766 116 methodsContentTree.addContent(writer.getMarkerAnchor(
bpatel@766 117 writer.getAnchor(member)));
bpatel@766 118 methodsContentTree.addContent(getHead(member));
bpatel@766 119 methodsContentTree.addContent(getSignature(member));
duke@1 120 }
duke@1 121
bpatel@766 122 /**
bpatel@766 123 * Add the deprecated information for this member.
bpatel@766 124 *
bpatel@766 125 * @param member the method to document.
bpatel@766 126 * @param methodsContentTree the tree to which the deprecated info will be added
bpatel@766 127 */
bpatel@766 128 public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree) {
bpatel@766 129 addDeprecatedInfo(member, methodsContentTree);
duke@1 130 }
duke@1 131
bpatel@766 132 /**
bpatel@766 133 * Add the description text for this member.
bpatel@766 134 *
bpatel@766 135 * @param member the method to document.
bpatel@766 136 * @param methodsContentTree the tree to which the deprecated info will be added
bpatel@766 137 */
bpatel@766 138 public void addMemberDescription(MethodDoc member, Content methodsContentTree) {
bpatel@766 139 addComment(member, methodsContentTree);
bpatel@766 140 }
bpatel@766 141
bpatel@766 142 /**
bpatel@766 143 * Add the tag information for this member.
bpatel@766 144 *
bpatel@766 145 * @param member the method to document.
bpatel@766 146 * @param methodsContentTree the tree to which the member tags info will be added
bpatel@766 147 */
bpatel@766 148 public void addMemberTags(MethodDoc member, Content methodsContentTree) {
duke@1 149 TagletOutputImpl output = new TagletOutputImpl("");
duke@1 150 TagletManager tagletManager =
duke@1 151 ConfigurationImpl.getInstance().tagletManager;
duke@1 152 TagletWriter.genTagOuput(tagletManager, member,
duke@1 153 tagletManager.getSerializedFormTags(),
duke@1 154 writer.getTagletWriterInstance(false), output);
bpatel@233 155 String outputString = output.toString().trim();
bpatel@766 156 Content dlTags = new HtmlTree(HtmlTag.DL);
bpatel@233 157 if (!outputString.isEmpty()) {
bpatel@766 158 Content tagContent = new RawHtml(outputString);
bpatel@766 159 dlTags.addContent(tagContent);
bpatel@233 160 }
bpatel@766 161 methodsContentTree.addContent(dlTags);
jjg@74 162 MethodDoc method = member;
duke@1 163 if (method.name().compareTo("writeExternal") == 0
duke@1 164 && method.tags("serialData").length == 0) {
duke@1 165 serialWarning(member.position(), "doclet.MissingSerialDataTag",
duke@1 166 method.containingClass().qualifiedName(), method.name());
duke@1 167 }
duke@1 168 }
duke@1 169
duke@1 170 protected void printTypeLinkNoDimension(Type type) {
duke@1 171 ClassDoc cd = type.asClassDoc();
duke@1 172 if (type.isPrimitive() || cd.isPackagePrivate()) {
duke@1 173 print(type.typeName());
duke@1 174 } else {
duke@1 175 writer.printLink(new LinkInfoImpl(
duke@1 176 LinkInfoImpl.CONTEXT_SERIAL_MEMBER,type));
duke@1 177 }
duke@1 178 }
duke@1 179 }

mercurial