001    /*
002     * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
003     * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004     *
005     * This code is free software; you can redistribute it and/or modify it
006     * under the terms of the GNU General Public License version 2 only, as
007     * published by the Free Software Foundation.  Sun designates this
008     * particular file as subject to the "Classpath" exception as provided
009     * by Sun in the LICENSE file that accompanied this code.
010     *
011     * This code is distributed in the hope that it will be useful, but WITHOUT
012     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014     * version 2 for more details (a copy is included in the LICENSE file that
015     * accompanied this code).
016     *
017     * You should have received a copy of the GNU General Public License version
018     * 2 along with this work; if not, write to the Free Software Foundation,
019     * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020     *
021     * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022     * CA 95054 USA or visit www.sun.com if you need additional information or
023     * have any questions.
024     */
025    
026    package com.sun.tools.doclets.internal.toolkit;
027    
028    import com.sun.tools.doclets.internal.toolkit.util.*;
029    import com.sun.javadoc.*;
030    
031    /**
032     * The interface for a factory creates writers.
033     *
034     * This code is not part of an API.
035     * It is implementation that is subject to change.
036     * Do not use it as an API
037     *
038     * @author Jamie Ho
039     * @since 1.4
040     */
041    
042    public interface WriterFactory {
043    
044        /**
045         * Return the writer for the constant summary.
046         *
047         * @return the writer for the constant summary.  Return null if this
048         * writer is not supported by the doclet.
049         */
050        public abstract ConstantsSummaryWriter getConstantsSummaryWriter()
051            throws Exception;
052    
053        /**
054         * Return the writer for the package summary.
055         *
056         * @param packageDoc the package being documented.
057         * @param prevPkg the previous package that was documented.
058         * @param nextPkg the next package being documented.
059         * @return the writer for the package summary.  Return null if this
060         * writer is not supported by the doclet.
061         */
062        public abstract PackageSummaryWriter getPackageSummaryWriter(PackageDoc
063            packageDoc, PackageDoc prevPkg, PackageDoc nextPkg)
064        throws Exception;
065    
066        /**
067         * Return the writer for a class.
068         *
069         * @param classDoc the class being documented.
070         * @param prevClass the previous class that was documented.
071         * @param nextClass the next class being documented.
072         * @param classTree the class tree.
073         * @return the writer for the class.  Return null if this
074         * writer is not supported by the doclet.
075         */
076        public abstract ClassWriter getClassWriter(ClassDoc classDoc,
077            ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
078                throws Exception;
079    
080        /**
081         * Return the writer for an annotation type.
082         *
083         * @param annotationType the type being documented.
084         * @param prevType the previous type that was documented.
085         * @param nextType the next type being documented.
086         * @return the writer for the annotation type.  Return null if this
087         * writer is not supported by the doclet.
088         */
089        public abstract AnnotationTypeWriter getAnnotationTypeWriter(
090            AnnotationTypeDoc annotationType, Type prevType, Type nextType)
091                throws Exception;
092    
093        /**
094         * Return the method writer for a given class.
095         *
096         * @param classWriter the writer for the class being documented.
097         * @return the method writer for the give class.  Return null if this
098         * writer is not supported by the doclet.
099         */
100        public abstract MethodWriter getMethodWriter(ClassWriter classWriter)
101                throws Exception;
102    
103        /**
104         * Return the annotation type optional member writer for a given annotation
105         * type.
106         *
107         * @param annotationTypeWriter the writer for the annotation type
108         *        being documented.
109         * @return the member writer for the given annotation type.  Return null if
110         *         this writer is not supported by the doclet.
111         */
112        public abstract AnnotationTypeOptionalMemberWriter
113                getAnnotationTypeOptionalMemberWriter(
114            AnnotationTypeWriter annotationTypeWriter) throws Exception;
115    
116        /**
117         * Return the annotation type required member writer for a given annotation type.
118         *
119         * @param annotationTypeWriter the writer for the annotation type
120         *        being documented.
121         * @return the member writer for the given annotation type.  Return null if
122         *         this writer is not supported by the doclet.
123         */
124        public abstract AnnotationTypeRequiredMemberWriter
125                getAnnotationTypeRequiredMemberWriter(
126            AnnotationTypeWriter annotationTypeWriter) throws Exception;
127    
128        /**
129         * Return the enum constant writer for a given class.
130         *
131         * @param classWriter the writer for the class being documented.
132         * @return the enum constant writer for the give class.  Return null if this
133         * writer is not supported by the doclet.
134         */
135        public abstract EnumConstantWriter getEnumConstantWriter(
136            ClassWriter classWriter) throws Exception;
137    
138        /**
139         * Return the field writer for a given class.
140         *
141         * @param classWriter the writer for the class being documented.
142         * @return the field writer for the give class.  Return null if this
143         * writer is not supported by the doclet.
144         */
145        public abstract FieldWriter getFieldWriter(ClassWriter classWriter)
146                throws Exception;
147    
148        /**
149         * Return the constructor writer for a given class.
150         *
151         * @param classWriter the writer for the class being documented.
152         * @return the method writer for the give class.  Return null if this
153         * writer is not supported by the doclet.
154         */
155        public abstract ConstructorWriter getConstructorWriter(
156            ClassWriter classWriter)
157        throws Exception;
158    
159        /**
160         * Return the specified member summary writer for a given class.
161         *
162         * @param classWriter the writer for the class being documented.
163         * @param memberType  the {@link VisibleMemberMap} member type indicating
164         *                    the type of member summary that should be returned.
165         * @return the summary writer for the give class.  Return null if this
166         * writer is not supported by the doclet.
167         *
168         * @see VisibleMemberMap
169         * @throws IllegalArgumentException if memberType is unknown.
170         */
171        public abstract MemberSummaryWriter getMemberSummaryWriter(
172            ClassWriter classWriter, int memberType)
173        throws Exception;
174    
175        /**
176         * Return the specified member summary writer for a given annotation type.
177         *
178         * @param annotationTypeWriter the writer for the annotation type being
179         *                             documented.
180         * @param memberType  the {@link VisibleMemberMap} member type indicating
181         *                    the type of member summary that should be returned.
182         * @return the summary writer for the give class.  Return null if this
183         * writer is not supported by the doclet.
184         *
185         * @see VisibleMemberMap
186         * @throws IllegalArgumentException if memberType is unknown.
187         */
188        public abstract MemberSummaryWriter getMemberSummaryWriter(
189            AnnotationTypeWriter annotationTypeWriter, int memberType)
190        throws Exception;
191    
192        /**
193         * Return the writer for the serialized form.
194         *
195         * @return the writer for the serialized form.
196         */
197        public SerializedFormWriter getSerializedFormWriter() throws Exception;
198    }