langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
author jjg
Fri, 18 Jun 2010 21:13:56 -0700
changeset 5855 00d9c252e60c
parent 5520 86e4b9a9da40
child 7614 cfadc977ca75
permissions -rw-r--r--
6961178: Allow doclet.xml to contain XML attributes Reviewed-by: bpatel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
     2
 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.internal.toolkit.builders;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.tools.doclets.internal.toolkit.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import com.sun.tools.doclets.internal.toolkit.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import java.io.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import java.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * Builds the summary for a given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * This code is not part of an API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * It is implementation that is subject to change.
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * Do not use it as an API
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
public class ClassBuilder extends AbstractBuilder {
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
     * The root element of the class XML is {@value}.
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    public static final String ROOT = "ClassDoc";
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     * The class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    private ClassDoc classDoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * The doclet specific writer.
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    private ClassWriter writer;
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
     * Keep track of whether or not this classdoc is an interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    private boolean isInterface = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * Keep track of whether or not this classdoc is an enum.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    private boolean isEnum = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * Construct a new ClassBuilder.
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     * @param configuration the current configuration of the
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     *                      doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    private ClassBuilder(Configuration configuration) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
        super(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     * Construct a new ClassBuilder.
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * @param configuration the current configuration of the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * @param classDoc the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * @param writer the doclet specific writer.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    public static ClassBuilder getInstance(Configuration configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        ClassDoc classDoc, ClassWriter writer)
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
        ClassBuilder builder = new ClassBuilder(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
        builder.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
        builder.classDoc = classDoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        builder.writer = writer;
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
        if (classDoc.isInterface()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
            builder.isInterface = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
        } else if (classDoc.isEnum()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
            builder.isEnum = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
            Util.setEnumDocumentation(configuration, classDoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        if(containingPackagesSeen == null) {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   102
            containingPackagesSeen = new HashSet<String>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
        return builder;
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    public void build() throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
        build(LayoutParser.getInstance(configuration).parseXML(ROOT));
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    public String getName() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        return ROOT;
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
      * Handles the &lt;ClassDoc> tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
      *
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
      * @param elements the XML elements that specify how to document a class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
      */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   126
     public void buildClassDoc(XMLNode node) throws Exception {
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   127
        buildChildren(node);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
        writer.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        copyDocFiles();
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     }
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
      * Copy the doc files for the current ClassDoc if necessary.
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
      */
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     private void copyDocFiles() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        PackageDoc containingPackage = classDoc.containingPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
        if((configuration.packages == null ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
                Arrays.binarySearch(configuration.packages,
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
                                    containingPackage) < 0) &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
           ! containingPackagesSeen.contains(containingPackage.name())){
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
            //Only copy doc files dir if the containing package is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
            //documented AND if we have not documented a class from the same
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
            //package already. Otherwise, we are making duplicate copies.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
            Util.copyDocFiles(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
                Util.getPackageSourcePath(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
                    classDoc.containingPackage()) +
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
                DirectoryManager.getDirectoryPath(classDoc.containingPackage())
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
                    + File.separator, DocletConstants.DOC_FILES_DIR_NAME, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
            containingPackagesSeen.add(containingPackage.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     }
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     * Build the header of the page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   157
    public void buildClassHeader(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        String key;
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        if (isInterface) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            key =  "doclet.Interface";
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        } else if (isEnum) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
            key = "doclet.Enum";
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
            key =  "doclet.Class";
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
        writer.writeHeader(configuration.getText(key) + " " + classDoc.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     * Build the class tree documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   173
    public void buildClassTree(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        writer.writeClassTree();
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     * If this is a class, list all interfaces
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     * implemented by this class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   181
    public void buildImplementedInterfacesInfo(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        writer.writeImplementedInterfacesInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     * If this is an interface, list all super interfaces.
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   188
    public void buildSuperInterfacesInfo(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
        writer.writeSuperInterfacesInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * List the parameters of this class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   195
    public void buildTypeParamInfo(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        writer.writeTypeParamInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * List all the classes extend this one.
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   202
    public void buildSubClassInfo(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
        writer.writeSubClassInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     * List all the interfaces that extend this one.
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   209
    public void buildSubInterfacesInfo(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
        writer.writeSubInterfacesInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     * If this is an interface, list all classes that implement this interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   216
    public void buildInterfaceUsageInfo (XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
        writer.writeInterfaceUsageInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
     * If this is an inner class or interface, list the enclosing class or
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     * interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   224
    public void buildNestedClassInfo (XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
        writer.writeNestedClassInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     * If this class is deprecated, print the appropriate information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   231
    public void buildDeprecationInfo (XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        writer.writeClassDeprecationInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
     * Build the signature of the current class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   238
    public void buildClassSignature(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        if (isEnum) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
            modifiers.append("enum ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            int index;
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
            if ((index = modifiers.indexOf("abstract")) >= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
                modifiers.delete(index, index + (new String("abstract")).length());
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
                modifiers = new StringBuffer(
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
                    Util.replaceText(modifiers.toString(), "  ", " "));
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
            if ((index = modifiers.indexOf("final")) >= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
                modifiers.delete(index, index + (new String("final")).length());
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
                modifiers = new StringBuffer(
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
                    Util.replaceText(modifiers.toString(), "  ", " "));
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
        //} else if (classDoc.isAnnotationType()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
            //modifiers.append("@interface ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
        } else if (! isInterface) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
            modifiers.append("class ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
        writer.writeClassSignature(modifiers.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     * Build the class description.
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   264
    public void buildClassDescription(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
       writer.writeClassDescription();
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
     * Build the tag information for the current class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   271
    public void buildClassTagInfo(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
       writer.writeClassTagInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
     * Build the contents of the page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
     * @param elements the XML elements that specify how a member summary is
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
     *                 documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   281
    public void buildMemberSummary(XMLNode node) throws Exception {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
        configuration.getBuilderFactory().
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   283
            getMemberSummaryBuilder(writer).buildChildren(node);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
        writer.completeMemberSummaryBuild();
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
     * Build the enum constants documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
     * @param elements the XML elements that specify how a enum constants are
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
     *                 documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   293
    public void buildEnumConstantsDetails(XMLNode node) throws Exception {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
        configuration.getBuilderFactory().
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   295
            getEnumConstantsBuilder(writer).buildChildren(node);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
     * Build the field documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
     * @param elements the XML elements that specify how a field is documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   303
    public void buildFieldDetails(XMLNode node) throws Exception {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
        configuration.getBuilderFactory().
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   305
            getFieldBuilder(writer).buildChildren(node);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
     * Build the constructor documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     * @param elements the XML elements that specify how to document a
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     * constructor.
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   314
    public void buildConstructorDetails(XMLNode node) throws Exception {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
        configuration.getBuilderFactory().
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   316
            getConstructorBuilder(writer).buildChildren(node);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
     * Build the method documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
     * @param elements the XML elements that specify how a method is documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   324
    public void buildMethodDetails(XMLNode node) throws Exception {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
        configuration.getBuilderFactory().
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   326
                getMethodBuilder(writer).buildChildren(node);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
     * Build the footer of the page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
     */
5855
00d9c252e60c 6961178: Allow doclet.xml to contain XML attributes
jjg
parents: 5520
diff changeset
   332
    public void buildClassFooter(XMLNode node) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
        writer.writeFooter();
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
}