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(
063: PackageDoc packageDoc, PackageDoc prevPkg,
064: PackageDoc nextPkg) 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,
091: Type nextType) 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 getAnnotationTypeOptionalMemberWriter(
113: AnnotationTypeWriter annotationTypeWriter) throws Exception;
114:
115: /**
116: * Return the annotation type required member writer for a given annotation type.
117: *
118: * @param annotationTypeWriter the writer for the annotation type
119: * being documented.
120: * @return the member writer for the given annotation type. Return null if
121: * this writer is not supported by the doclet.
122: */
123: public abstract AnnotationTypeRequiredMemberWriter getAnnotationTypeRequiredMemberWriter(
124: AnnotationTypeWriter annotationTypeWriter) throws Exception;
125:
126: /**
127: * Return the enum constant writer for a given class.
128: *
129: * @param classWriter the writer for the class being documented.
130: * @return the enum constant writer for the give class. Return null if this
131: * writer is not supported by the doclet.
132: */
133: public abstract EnumConstantWriter getEnumConstantWriter(
134: ClassWriter classWriter) throws Exception;
135:
136: /**
137: * Return the field writer for a given class.
138: *
139: * @param classWriter the writer for the class being documented.
140: * @return the field writer for the give class. Return null if this
141: * writer is not supported by the doclet.
142: */
143: public abstract FieldWriter getFieldWriter(ClassWriter classWriter)
144: throws Exception;
145:
146: /**
147: * Return the constructor writer for a given class.
148: *
149: * @param classWriter the writer for the class being documented.
150: * @return the method writer for the give class. Return null if this
151: * writer is not supported by the doclet.
152: */
153: public abstract ConstructorWriter getConstructorWriter(
154: ClassWriter classWriter) throws Exception;
155:
156: /**
157: * Return the specified member summary writer for a given class.
158: *
159: * @param classWriter the writer for the class being documented.
160: * @param memberType the {@link VisibleMemberMap} member type indicating
161: * the type of member summary that should be returned.
162: * @return the summary writer for the give class. Return null if this
163: * writer is not supported by the doclet.
164: *
165: * @see VisibleMemberMap
166: * @throws IllegalArgumentException if memberType is unknown.
167: */
168: public abstract MemberSummaryWriter getMemberSummaryWriter(
169: ClassWriter classWriter, int memberType) throws Exception;
170:
171: /**
172: * Return the specified member summary writer for a given annotation type.
173: *
174: * @param annotationTypeWriter the writer for the annotation type being
175: * documented.
176: * @param memberType the {@link VisibleMemberMap} member type indicating
177: * the type of member summary that should be returned.
178: * @return the summary writer for the give class. Return null if this
179: * writer is not supported by the doclet.
180: *
181: * @see VisibleMemberMap
182: * @throws IllegalArgumentException if memberType is unknown.
183: */
184: public abstract MemberSummaryWriter getMemberSummaryWriter(
185: AnnotationTypeWriter annotationTypeWriter, int memberType)
186: throws Exception;
187:
188: /**
189: * Return the writer for the serialized form.
190: *
191: * @return the writer for the serialized form.
192: */
193: public SerializedFormWriter getSerializedFormWriter()
194: throws Exception;
195: }
|