src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java

Tue, 28 Dec 2010 15:54:52 -0800

author
ohair
date
Tue, 28 Dec 2010 15:54:52 -0800
changeset 798
4868a36f6fd8
parent 554
9d9f26857129
child 1357
c75be5bc5283
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

duke@1 1 /*
ohair@554 2 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.internal.toolkit.builders;
duke@1 27
duke@1 28 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 29 import com.sun.tools.doclets.internal.toolkit.util.*;
duke@1 30 import com.sun.javadoc.*;
duke@1 31
duke@1 32 /**
duke@1 33 * The factory for constructing builders.
duke@1 34 *
duke@1 35 * This code is not part of an API.
duke@1 36 * It is implementation that is subject to change.
duke@1 37 * Do not use it as an API
duke@1 38 *
duke@1 39 * @author Jamie Ho
duke@1 40 * @since 1.4
duke@1 41 */
duke@1 42
duke@1 43 public class BuilderFactory {
duke@1 44
duke@1 45 /**
duke@1 46 * The current configuration of the doclet.
duke@1 47 */
duke@1 48 private Configuration configuration;
duke@1 49
duke@1 50 /**
duke@1 51 * The factory to retrieve the required writers from.
duke@1 52 */
duke@1 53 private WriterFactory writerFactory;
duke@1 54
duke@1 55 /**
duke@1 56 * Construct a builder factory using the given configuration.
duke@1 57 * @param configuration the configuration for the current doclet
duke@1 58 * being executed.
duke@1 59 */
duke@1 60 public BuilderFactory (Configuration configuration) {
duke@1 61 this.configuration = configuration;
duke@1 62 this.writerFactory = configuration.getWriterFactory();
duke@1 63 }
duke@1 64
duke@1 65 /**
duke@1 66 * Return the builder that builds the constant summary.
duke@1 67 * @return the builder that builds the constant summary.
duke@1 68 */
duke@1 69 public AbstractBuilder getConstantsSummaryBuider() throws Exception {
duke@1 70 return ConstantsSummaryBuilder.getInstance(configuration,
duke@1 71 writerFactory.getConstantsSummaryWriter());
duke@1 72 }
duke@1 73
duke@1 74 /**
duke@1 75 * Return the builder that builds the package summary.
duke@1 76 *
duke@1 77 * @param pkg the package being documented.
duke@1 78 * @param prevPkg the previous package being documented.
duke@1 79 * @param nextPkg the next package being documented.
duke@1 80 * @return the builder that builds the constant summary.
duke@1 81 */
duke@1 82 public AbstractBuilder getPackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
duke@1 83 PackageDoc nextPkg) throws Exception {
duke@1 84 return PackageSummaryBuilder.getInstance(configuration, pkg,
duke@1 85 writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
duke@1 86 }
duke@1 87
duke@1 88 /**
duke@1 89 * Return the builder for the class.
duke@1 90 *
duke@1 91 * @param classDoc the class being documented.
duke@1 92 * @param prevClass the previous class that was documented.
duke@1 93 * @param nextClass the next class being documented.
duke@1 94 * @param classTree the class tree.
duke@1 95 * @return the writer for the class. Return null if this
duke@1 96 * writer is not supported by the doclet.
duke@1 97 */
duke@1 98 public AbstractBuilder getClassBuilder(ClassDoc classDoc,
duke@1 99 ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
duke@1 100 throws Exception {
duke@1 101 return ClassBuilder.getInstance(configuration, classDoc,
duke@1 102 writerFactory.getClassWriter(classDoc, prevClass, nextClass,
duke@1 103 classTree));
duke@1 104 }
duke@1 105
duke@1 106 /**
duke@1 107 * Return the builder for the annotation type.
duke@1 108 *
duke@1 109 * @param annotationType the annotation type being documented.
duke@1 110 * @param prevType the previous type that was documented.
duke@1 111 * @param nextType the next type being documented.
duke@1 112 * @return the writer for the annotation type. Return null if this
duke@1 113 * writer is not supported by the doclet.
duke@1 114 */
duke@1 115 public AbstractBuilder getAnnotationTypeBuilder(
duke@1 116 AnnotationTypeDoc annotationType,
duke@1 117 Type prevType, Type nextType)
duke@1 118 throws Exception {
duke@1 119 return AnnotationTypeBuilder.getInstance(configuration, annotationType,
duke@1 120 writerFactory.getAnnotationTypeWriter(annotationType, prevType,
duke@1 121 nextType));
duke@1 122 }
duke@1 123
duke@1 124 /**
duke@1 125 * Return an instance of the method builder for the given class.
duke@1 126 *
duke@1 127 * @return an instance of the method builder for the given class.
duke@1 128 */
duke@1 129 public AbstractBuilder getMethodBuilder(ClassWriter classWriter)
duke@1 130 throws Exception {
duke@1 131 return MethodBuilder.getInstance(configuration,
duke@1 132 classWriter.getClassDoc(),
duke@1 133 writerFactory.getMethodWriter(classWriter));
duke@1 134 }
duke@1 135
duke@1 136 /**
duke@1 137 * Return an instance of the annotation type member builder for the given
duke@1 138 * class.
duke@1 139 *
duke@1 140 * @return an instance of the annotation type memebr builder for the given
duke@1 141 * annotation type.
duke@1 142 */
duke@1 143 public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
duke@1 144 AnnotationTypeWriter annotationTypeWriter)
duke@1 145 throws Exception {
duke@1 146 return AnnotationTypeOptionalMemberBuilder.getInstance(configuration,
duke@1 147 annotationTypeWriter.getAnnotationTypeDoc(),
duke@1 148 writerFactory.getAnnotationTypeOptionalMemberWriter(
duke@1 149 annotationTypeWriter));
duke@1 150 }
duke@1 151
duke@1 152 /**
duke@1 153 * Return an instance of the annotation type member builder for the given
duke@1 154 * class.
duke@1 155 *
duke@1 156 * @return an instance of the annotation type memebr builder for the given
duke@1 157 * annotation type.
duke@1 158 */
duke@1 159 public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
duke@1 160 AnnotationTypeWriter annotationTypeWriter)
duke@1 161 throws Exception {
duke@1 162 return AnnotationTypeRequiredMemberBuilder.getInstance(configuration,
duke@1 163 annotationTypeWriter.getAnnotationTypeDoc(),
duke@1 164 writerFactory.getAnnotationTypeRequiredMemberWriter(
duke@1 165 annotationTypeWriter));
duke@1 166 }
duke@1 167
duke@1 168 /**
duke@1 169 * Return an instance of the enum constants builder for the given class.
duke@1 170 *
duke@1 171 * @return an instance of the enum constants builder for the given class.
duke@1 172 */
duke@1 173 public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter)
duke@1 174 throws Exception {
duke@1 175 return EnumConstantBuilder.getInstance(configuration, classWriter.getClassDoc(),
duke@1 176 writerFactory.getEnumConstantWriter(classWriter));
duke@1 177 }
duke@1 178
duke@1 179 /**
duke@1 180 * Return an instance of the field builder for the given class.
duke@1 181 *
duke@1 182 * @return an instance of the field builder for the given class.
duke@1 183 */
duke@1 184 public AbstractBuilder getFieldBuilder(ClassWriter classWriter)
duke@1 185 throws Exception {
duke@1 186 return FieldBuilder.getInstance(configuration, classWriter.getClassDoc(),
duke@1 187 writerFactory.getFieldWriter(classWriter));
duke@1 188 }
duke@1 189
duke@1 190 /**
duke@1 191 * Return an instance of the constructor builder for the given class.
duke@1 192 *
duke@1 193 * @return an instance of the constructor builder for the given class.
duke@1 194 */
duke@1 195 public AbstractBuilder getConstructorBuilder(ClassWriter classWriter)
duke@1 196 throws Exception {
duke@1 197 return ConstructorBuilder.getInstance(configuration,
duke@1 198 classWriter.getClassDoc(), writerFactory.getConstructorWriter(
duke@1 199 classWriter));
duke@1 200 }
duke@1 201
duke@1 202 /**
duke@1 203 * Return an instance of the member summary builder for the given class.
duke@1 204 *
duke@1 205 * @return an instance of the member summary builder for the given class.
duke@1 206 */
duke@1 207 public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter)
duke@1 208 throws Exception {
duke@1 209 return MemberSummaryBuilder.getInstance(classWriter, configuration);
duke@1 210 }
duke@1 211
duke@1 212 /**
duke@1 213 * Return an instance of the member summary builder for the given annotation
duke@1 214 * type.
duke@1 215 *
duke@1 216 * @return an instance of the member summary builder for the given
duke@1 217 * annotation type.
duke@1 218 */
duke@1 219 public AbstractBuilder getMemberSummaryBuilder(
duke@1 220 AnnotationTypeWriter annotationTypeWriter)
duke@1 221 throws Exception {
duke@1 222 return MemberSummaryBuilder.getInstance(annotationTypeWriter,
duke@1 223 configuration);
duke@1 224 }
duke@1 225
duke@1 226 /**
duke@1 227 * Return the builder that builds the serialized form.
duke@1 228 *
duke@1 229 * @return the builder that builds the serialized form.
duke@1 230 */
duke@1 231 public AbstractBuilder getSerializedFormBuilder()
duke@1 232 throws Exception {
duke@1 233 return SerializedFormBuilder.getInstance(configuration);
duke@1 234 }
duke@1 235 }

mercurial