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

Sun, 11 Apr 2010 23:24:24 -0700

author
yhuang
date
Sun, 11 Apr 2010 23:24:24 -0700
changeset 539
06e06ec0d6f2
parent 233
5240b1120530
child 554
9d9f26857129
permissions
-rw-r--r--

6875904: Java 7 message synchronization 1
Reviewed-by: ogino, faryad

     1 /*
     2  * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any questions.
    24  */
    26 package com.sun.tools.doclets.formats.html;
    28 import com.sun.javadoc.*;
    29 import com.sun.tools.doclets.internal.toolkit.*;
    30 import com.sun.tools.doclets.internal.toolkit.taglets.*;
    32 /**
    33  * Generate serialized form for Serializable/Externalizable methods.
    34  * Documentation denoted by the <code>serialData</code> tag is processed.
    35  *
    36  * @author Joe Fialli
    37  */
    38 public class HtmlSerialMethodWriter extends MethodWriterImpl implements
    39         SerializedFormWriter.SerialMethodWriter{
    41     private boolean printedFirstMember = false;
    43     public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
    44             ClassDoc classdoc) {
    45         super(writer, classdoc);
    46     }
    48     public void writeHeader(String heading) {
    49         writer.anchor("serialized_methods");
    50         writer.printTableHeadingBackground(heading);
    51         writer.p();
    52     }
    54     public void writeNoCustomizationMsg(String msg) {
    55         writer.print(msg);
    56         writer.p();
    57     }
    59     public void writeMemberHeader(MethodDoc member) {
    60         if (printedFirstMember) {
    61             writer.printMemberHeader();
    62         }
    63         printedFirstMember = true;
    64         writer.anchor(member);
    65         printHead(member);
    66         writeSignature(member);
    67     }
    69     public void writeMemberFooter() {
    70         printMemberFooter();
    71     }
    73     public void writeDeprecatedMemberInfo(MethodDoc member) {
    74         printDeprecated(member);
    75     }
    77     public void writeMemberDescription(MethodDoc member) {
    78         printComment(member);
    79     }
    81     public void writeMemberTags(MethodDoc member) {
    82         TagletOutputImpl output = new TagletOutputImpl("");
    83         TagletManager tagletManager =
    84             ConfigurationImpl.getInstance().tagletManager;
    85         TagletWriter.genTagOuput(tagletManager, member,
    86             tagletManager.getSerializedFormTags(),
    87             writer.getTagletWriterInstance(false), output);
    88         String outputString = output.toString().trim();
    89         if (!outputString.isEmpty()) {
    90             writer.printMemberDetailsListStartTag();
    91             writer.dd();
    92             writer.dl();
    93             print(outputString);
    94             writer.dlEnd();
    95             writer.ddEnd();
    96         }
    97         MethodDoc method = member;
    98         if (method.name().compareTo("writeExternal") == 0
    99                 && method.tags("serialData").length == 0) {
   100             serialWarning(member.position(), "doclet.MissingSerialDataTag",
   101                 method.containingClass().qualifiedName(), method.name());
   102         }
   103     }
   105     protected void printTypeLinkNoDimension(Type type) {
   106         ClassDoc cd = type.asClassDoc();
   107         if (type.isPrimitive() || cd.isPackagePrivate()) {
   108             print(type.typeName());
   109         } else {
   110             writer.printLink(new LinkInfoImpl(
   111                 LinkInfoImpl.CONTEXT_SERIAL_MEMBER,type));
   112         }
   113     }
   114 }

mercurial