1/* 2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package jdk.javadoc.internal.doclets.toolkit; 27 28import javax.lang.model.element.ModuleElement; 29import javax.lang.model.element.PackageElement; 30import javax.lang.model.element.TypeElement; 31import javax.lang.model.type.TypeMirror; 32 33import jdk.javadoc.internal.doclets.toolkit.util.ClassTree; 34import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap; 35 36/** 37 * The interface for a factory creates writers. 38 * 39 * <p><b>This is NOT part of any supported API. 40 * If you write code that depends on this, you do so at your own risk. 41 * This code and its internal interfaces are subject to change or 42 * deletion without notice.</b> 43 * 44 * @author Jamie Ho 45 */ 46 47public interface WriterFactory { 48 49 /** 50 * Return the writer for the constant summary. 51 * 52 * @return the writer for the constant summary. Return null if this 53 * writer is not supported by the doclet. 54 */ 55 public abstract ConstantsSummaryWriter getConstantsSummaryWriter(); 56 57 /** 58 * Return the writer for the package summary. 59 * 60 * @param packageElement the package being documented. 61 * @param prevPkg the previous package that was documented. 62 * @param nextPkg the next package being documented. 63 * @return the writer for the package summary. Return null if this 64 * writer is not supported by the doclet. 65 */ 66 public abstract PackageSummaryWriter getPackageSummaryWriter(PackageElement 67 packageElement, PackageElement prevPkg, PackageElement nextPkg); 68 69 /** 70 * Return the writer for the module summary. 71 * 72 * @param mdle the module being documented. 73 * @param prevModule the previous module that was documented. 74 * @param nextModule the next module being documented. 75 * @return the writer for the module summary. Return null if this 76 * writer is not supported by the doclet. 77 */ 78 public abstract ModuleSummaryWriter getModuleSummaryWriter( 79 ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule); 80 81 /** 82 * Return the writer for a class. 83 * 84 * @param typeElement the class being documented. 85 * @param prevClass the previous class that was documented. 86 * @param nextClass the next class being documented. 87 * @param classTree the class tree. 88 * @return the writer for the class. Return null if this 89 * writer is not supported by the doclet. 90 */ 91 public abstract ClassWriter getClassWriter(TypeElement typeElement, 92 TypeElement prevClass, TypeElement nextClass, ClassTree classTree); 93 94 /** 95 * Return the writer for an annotation type. 96 * 97 * @param annotationType the type being documented. 98 * @param prevType the previous type that was documented. 99 * @param nextType the next type being documented. 100 * @return the writer for the annotation type. Return null if this 101 * writer is not supported by the doclet. 102 */ 103 public abstract AnnotationTypeWriter getAnnotationTypeWriter( 104 TypeElement annotationType, TypeMirror prevType, TypeMirror nextType); 105 106 /** 107 * Return the method writer for a given class. 108 * 109 * @param classWriter the writer for the class being documented. 110 * @return the method writer for the give class. Return null if this 111 * writer is not supported by the doclet. 112 */ 113 public abstract MethodWriter getMethodWriter(ClassWriter classWriter); 114 115 /** 116 * Return the annotation type field 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 AnnotationTypeFieldWriter 124 getAnnotationTypeFieldWriter( 125 AnnotationTypeWriter annotationTypeWriter); 126 127 /** 128 * Return the annotation type optional member writer for a given annotation 129 * type. 130 * 131 * @param annotationTypeWriter the writer for the annotation type 132 * being documented. 133 * @return the member writer for the given annotation type. Return null if 134 * this writer is not supported by the doclet. 135 */ 136 public abstract AnnotationTypeOptionalMemberWriter 137 getAnnotationTypeOptionalMemberWriter( 138 AnnotationTypeWriter annotationTypeWriter); 139 140 /** 141 * Return the annotation type required member writer for a given annotation type. 142 * 143 * @param annotationTypeWriter the writer for the annotation type 144 * being documented. 145 * @return the member writer for the given annotation type. Return null if 146 * this writer is not supported by the doclet. 147 */ 148 public abstract AnnotationTypeRequiredMemberWriter 149 getAnnotationTypeRequiredMemberWriter( 150 AnnotationTypeWriter annotationTypeWriter); 151 152 /** 153 * Return the enum constant writer for a given class. 154 * 155 * @param classWriter the writer for the class being documented. 156 * @return the enum constant writer for the give class. Return null if this 157 * writer is not supported by the doclet. 158 */ 159 public abstract EnumConstantWriter getEnumConstantWriter( 160 ClassWriter classWriter); 161 162 /** 163 * Return the field writer for a given class. 164 * 165 * @param classWriter the writer for the class being documented. 166 * @return the field writer for the give class. Return null if this 167 * writer is not supported by the doclet. 168 */ 169 public abstract FieldWriter getFieldWriter(ClassWriter classWriter); 170 171 /** 172 * Return the property writer for a given class. 173 * 174 * @param classWriter the writer for the class being documented. 175 * @return the property writer for the give class. Return null if this 176 * writer is not supported by the doclet. 177 */ 178 public abstract PropertyWriter getPropertyWriter(ClassWriter classWriter); 179 180 /** 181 * Return the constructor writer for a given class. 182 * 183 * @param classWriter the writer for the class being documented. 184 * @return the method writer for the give class. Return null if this 185 * writer is not supported by the doclet. 186 */ 187 public abstract ConstructorWriter getConstructorWriter( 188 ClassWriter classWriter); 189 190 /** 191 * Return the specified member summary writer for a given class. 192 * 193 * @param classWriter the writer for the class being documented. 194 * @param memberType the {@link VisibleMemberMap} member type indicating 195 * the type of member summary that should be returned. 196 * @return the summary writer for the give class. Return null if this 197 * writer is not supported by the doclet. 198 * 199 * @see VisibleMemberMap 200 */ 201 public abstract MemberSummaryWriter getMemberSummaryWriter( 202 ClassWriter classWriter, VisibleMemberMap.Kind memberType); 203 204 /** 205 * Return the specified member summary writer for a given annotation type. 206 * 207 * @param annotationTypeWriter the writer for the annotation type being 208 * documented. 209 * @param memberType the {@link VisibleMemberMap} member type indicating 210 * the type of member summary that should be returned. 211 * @return the summary writer for the give class. Return null if this 212 * writer is not supported by the doclet. 213 * 214 * @see VisibleMemberMap 215 */ 216 public abstract MemberSummaryWriter getMemberSummaryWriter( 217 AnnotationTypeWriter annotationTypeWriter, VisibleMemberMap.Kind memberType); 218 219 /** 220 * Return the writer for the serialized form. 221 * 222 * @return the writer for the serialized form. 223 */ 224 public SerializedFormWriter getSerializedFormWriter(); 225} 226