langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
author jjg
Tue, 15 Jul 2008 19:22:51 -0700
changeset 868 d0f233085cbb
parent 10 06bc494ca11e
child 1264 076a3cde30d5
permissions -rw-r--r--
6657907: javadoc has unchecked warnings Reviewed-by: bpatel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
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
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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
import java.lang.reflect.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * Builds the summary for a given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * This code is not part of an API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * It is implementation that is subject to change.
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * Do not use it as an API
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
public class ClassBuilder extends AbstractBuilder {
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
     * The root element of the class XML is {@value}.
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    public static final String ROOT = "ClassDoc";
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     * The class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    private ClassDoc classDoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * The doclet specific writer.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
    private ClassWriter writer;
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     * Keep track of whether or not this classdoc is an interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    private boolean isInterface = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     * Keep track of whether or not this classdoc is an enum.
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    private boolean isEnum = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     * Construct a new ClassBuilder.
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * @param configuration the current configuration of the
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     *                      doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    private ClassBuilder(Configuration configuration) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
        super(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * Construct a new ClassBuilder.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * @param configuration the current configuration of the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * @param classDoc the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * @param writer the doclet specific writer.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    public static ClassBuilder getInstance(Configuration configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
        ClassDoc classDoc, ClassWriter writer)
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
        ClassBuilder builder = new ClassBuilder(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
        builder.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        builder.classDoc = classDoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
        builder.writer = writer;
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
        if (classDoc.isInterface()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
            builder.isInterface = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
        } else if (classDoc.isEnum()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
            builder.isEnum = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
            Util.setEnumDocumentation(configuration, classDoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        if(containingPackagesSeen == null) {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   103
            containingPackagesSeen = new HashSet<String>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
        return builder;
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
    public void invokeMethod(String methodName, Class[] paramClasses,
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
            Object[] params)
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        if (DEBUG) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
            configuration.root.printError("DEBUG: " + this.getClass().getName()
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
                + "." + methodName);
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        Method method = this.getClass().getMethod(methodName, paramClasses);
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        method.invoke(this, params);
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    public void build() throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        build(LayoutParser.getInstance(configuration).parseXML(ROOT));
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    public String getName() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
        return ROOT;
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
      * Handles the &lt;ClassDoc> tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
      *
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
      * @param elements the XML elements that specify how to document a class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
      */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     public void buildClassDoc(List elements) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        writer.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
        copyDocFiles();
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     }
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
      * Copy the doc files for the current ClassDoc if necessary.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
      */
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     private void copyDocFiles() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
        PackageDoc containingPackage = classDoc.containingPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        if((configuration.packages == null ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
                Arrays.binarySearch(configuration.packages,
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
                                    containingPackage) < 0) &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
           ! containingPackagesSeen.contains(containingPackage.name())){
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
            //Only copy doc files dir if the containing package is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
            //documented AND if we have not documented a class from the same
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
            //package already. Otherwise, we are making duplicate copies.
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            Util.copyDocFiles(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
                Util.getPackageSourcePath(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
                    classDoc.containingPackage()) +
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
                DirectoryManager.getDirectoryPath(classDoc.containingPackage())
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
                    + File.separator, DocletConstants.DOC_FILES_DIR_NAME, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
            containingPackagesSeen.add(containingPackage.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     }
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     * Build the header of the page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    public void buildClassHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
        String key;
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        if (isInterface) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
            key =  "doclet.Interface";
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        } else if (isEnum) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
            key = "doclet.Enum";
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
            key =  "doclet.Class";
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        writer.writeHeader(configuration.getText(key) + " " + classDoc.name());
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
     * Build the class tree documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    public void buildClassTree() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
        writer.writeClassTree();
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
     * If this is a class, list all interfaces
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     * implemented by this class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
    public void buildImplementedInterfacesInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        writer.writeImplementedInterfacesInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     * If this is an interface, list all super interfaces.
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    public void buildSuperInterfacesInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        writer.writeSuperInterfacesInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     * List the parameters of this class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    public void buildTypeParamInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
        writer.writeTypeParamInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     * List all the classes extend this one.
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
    public void buildSubClassInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
        writer.writeSubClassInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     * List all the interfaces that extend this one.
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
    public void buildSubInterfacesInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
        writer.writeSubInterfacesInfo();
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 is an interface, list all classes that implement this interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    public void buildInterfaceUsageInfo () {
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        writer.writeInterfaceUsageInfo();
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
     * If this is an inner class or interface, list the enclosing class or
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
     * interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
    public void buildNestedClassInfo () {
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        writer.writeNestedClassInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
     * If this class is deprecated, print the appropriate information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
    public void buildDeprecationInfo () {
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
        writer.writeClassDeprecationInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
     * Build the signature of the current class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    public void buildClassSignature() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
        StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
        if (isEnum) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
            modifiers.append("enum ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
            int index;
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
            if ((index = modifiers.indexOf("abstract")) >= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
                modifiers.delete(index, index + (new String("abstract")).length());
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
                modifiers = new StringBuffer(
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
                    Util.replaceText(modifiers.toString(), "  ", " "));
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
            if ((index = modifiers.indexOf("final")) >= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
                modifiers.delete(index, index + (new String("final")).length());
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
                modifiers = new StringBuffer(
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
                    Util.replaceText(modifiers.toString(), "  ", " "));
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        //} else if (classDoc.isAnnotationType()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
            //modifiers.append("@interface ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        } else if (! isInterface) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
            modifiers.append("class ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
        writer.writeClassSignature(modifiers.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
     * Build the class description.
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    public void buildClassDescription() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
       writer.writeClassDescription();
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
     * Build the tag information for the current class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
    public void buildClassTagInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
       writer.writeClassTagInfo();
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
     * Build the contents of the page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
     * @param elements the XML elements that specify how a member summary is
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     *                 documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
    public void buildMemberSummary(List elements) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        configuration.getBuilderFactory().
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
            getMemberSummaryBuilder(writer).build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
        writer.completeMemberSummaryBuild();
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
     * Build the enum constants documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
     * @param elements the XML elements that specify how a enum constants are
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
     *                 documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
    public void buildEnumConstantsDetails(List elements) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
        configuration.getBuilderFactory().
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
            getEnumConstantsBuilder(writer).build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
     * Build the field documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     * @param elements the XML elements that specify how a field is documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
    public void buildFieldDetails(List elements) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
        configuration.getBuilderFactory().
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
            getFieldBuilder(writer).build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
     * Build the constructor documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
     * @param elements the XML elements that specify how to document a
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
     * constructor.
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
    public void buildConstructorDetails(List elements) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
        configuration.getBuilderFactory().
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
            getConstructorBuilder(writer).build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
     * Build the method documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
     * @param elements the XML elements that specify how a method is documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
    public void buildMethodDetails(List elements) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
        configuration.getBuilderFactory().
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
                getMethodBuilder(writer).build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
     * Build the footer of the page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
    public void buildClassFooter() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
        writer.writeFooter();
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
}