langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java
author ohair
Tue, 25 May 2010 15:54:51 -0700
changeset 5520 86e4b9a9da40
parent 10 06bc494ca11e
child 14258 8d2148961366
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
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: 10
diff changeset
     2
 * Copyright (c) 2003, 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: 10
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: 10
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: 10
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
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;
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.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * The interface for a factory creates writers.
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * This code is not part of an API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * It is implementation that is subject to change.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * Do not use it as an API
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * @since 1.4
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
public interface WriterFactory {
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
     * Return the writer for the constant summary.
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
     * @return the writer for the constant summary.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    public abstract ConstantsSummaryWriter getConstantsSummaryWriter()
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
        throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
     * Return the writer for the package summary.
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * @param packageDoc the package being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * @param prevPkg the previous package that was documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * @param nextPkg the next package being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     * @return the writer for the package summary.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    public abstract PackageSummaryWriter getPackageSummaryWriter(PackageDoc
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
        packageDoc, PackageDoc prevPkg, PackageDoc nextPkg)
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * Return the writer for a class.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     * @param classDoc the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     * @param prevClass the previous class that was documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * @param nextClass the next class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * @param classTree the class tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     * @return the writer for the class.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    public abstract ClassWriter getClassWriter(ClassDoc classDoc,
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
        ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
            throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     * Return the writer for an annotation type.
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * @param annotationType the type being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * @param prevType the previous type that was documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * @param nextType the next type being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * @return the writer for the annotation type.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    public abstract AnnotationTypeWriter getAnnotationTypeWriter(
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
        AnnotationTypeDoc annotationType, Type prevType, Type nextType)
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
            throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     * Return the method writer for a given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * @param classWriter the writer for the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * @return the method writer for the give class.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    public abstract MethodWriter getMethodWriter(ClassWriter classWriter)
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
            throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     * Return the annotation type optional member writer for a given annotation
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * @param annotationTypeWriter the writer for the annotation type
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     *        being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * @return the member writer for the given annotation type.  Return null if
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     *         this writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    public abstract AnnotationTypeOptionalMemberWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
            getAnnotationTypeOptionalMemberWriter(
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        AnnotationTypeWriter annotationTypeWriter) throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * Return the annotation type required member writer for a given annotation type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     * @param annotationTypeWriter the writer for the annotation type
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     *        being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     * @return the member writer for the given annotation type.  Return null if
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     *         this writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
    public abstract AnnotationTypeRequiredMemberWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
            getAnnotationTypeRequiredMemberWriter(
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        AnnotationTypeWriter annotationTypeWriter) throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * Return the enum constant writer for a given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * @param classWriter the writer for the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * @return the enum constant writer for the give class.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    public abstract EnumConstantWriter getEnumConstantWriter(
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        ClassWriter classWriter) throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * Return the field writer for a given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * @param classWriter the writer for the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * @return the field writer for the give class.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    public abstract FieldWriter getFieldWriter(ClassWriter classWriter)
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
            throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * Return the constructor writer for a given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * @param classWriter the writer for the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * @return the method writer for the give class.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    public abstract ConstructorWriter getConstructorWriter(
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        ClassWriter classWriter)
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * Return the specified member summary writer for a given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * @param classWriter the writer for the class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     * @param memberType  the {@link VisibleMemberMap} member type indicating
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     *                    the type of member summary that should be returned.
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     * @return the summary writer for the give class.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * @see VisibleMemberMap
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     * @throws IllegalArgumentException if memberType is unknown.
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    public abstract MemberSummaryWriter getMemberSummaryWriter(
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
        ClassWriter classWriter, int memberType)
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     * Return the specified member summary writer for a given annotation type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     * @param annotationTypeWriter the writer for the annotation type being
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     *                             documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     * @param memberType  the {@link VisibleMemberMap} member type indicating
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
     *                    the type of member summary that should be returned.
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     * @return the summary writer for the give class.  Return null if this
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     * writer is not supported by the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     * @see VisibleMemberMap
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     * @throws IllegalArgumentException if memberType is unknown.
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    public abstract MemberSummaryWriter getMemberSummaryWriter(
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
        AnnotationTypeWriter annotationTypeWriter, int memberType)
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
    throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * Return the writer for the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     * @return the writer for the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    public SerializedFormWriter getSerializedFormWriter() throws Exception;
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
}