src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.tools.doclets.formats.html;
aoqi@0 27
aoqi@0 28 import java.io.IOException;
aoqi@0 29
aoqi@0 30 import com.sun.javadoc.*;
aoqi@0 31 import com.sun.tools.javac.jvm.Profile;
aoqi@0 32 import com.sun.tools.doclets.internal.toolkit.*;
aoqi@0 33 import com.sun.tools.doclets.internal.toolkit.util.*;
aoqi@0 34
aoqi@0 35 /**
aoqi@0 36 * The factory that returns HTML writers.
aoqi@0 37 *
aoqi@0 38 * <p><b>This is NOT part of any supported API.
aoqi@0 39 * If you write code that depends on this, you do so at your own risk.
aoqi@0 40 * This code and its internal interfaces are subject to change or
aoqi@0 41 * deletion without notice.</b>
aoqi@0 42 *
aoqi@0 43 * @author Jamie Ho
aoqi@0 44 * @since 1.5
aoqi@0 45 */
aoqi@0 46 public class WriterFactoryImpl implements WriterFactory {
aoqi@0 47
aoqi@0 48 private final ConfigurationImpl configuration;
aoqi@0 49
aoqi@0 50 public WriterFactoryImpl(ConfigurationImpl configuration) {
aoqi@0 51 this.configuration = configuration;
aoqi@0 52 }
aoqi@0 53
aoqi@0 54 /**
aoqi@0 55 * {@inheritDoc}
aoqi@0 56 */
aoqi@0 57 public ConstantsSummaryWriter getConstantsSummaryWriter() throws Exception {
aoqi@0 58 return new ConstantsSummaryWriterImpl(configuration);
aoqi@0 59 }
aoqi@0 60
aoqi@0 61 /**
aoqi@0 62 * {@inheritDoc}
aoqi@0 63 */
aoqi@0 64 public PackageSummaryWriter getPackageSummaryWriter(PackageDoc packageDoc,
aoqi@0 65 PackageDoc prevPkg, PackageDoc nextPkg) throws Exception {
aoqi@0 66 return new PackageWriterImpl(configuration, packageDoc,
aoqi@0 67 prevPkg, nextPkg);
aoqi@0 68 }
aoqi@0 69
aoqi@0 70 /**
aoqi@0 71 * {@inheritDoc}
aoqi@0 72 */
aoqi@0 73 public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
aoqi@0 74 Profile prevProfile, Profile nextProfile) throws Exception {
aoqi@0 75 return new ProfileWriterImpl(configuration, profile,
aoqi@0 76 prevProfile, nextProfile);
aoqi@0 77 }
aoqi@0 78
aoqi@0 79 /**
aoqi@0 80 * {@inheritDoc}
aoqi@0 81 */
aoqi@0 82 public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
aoqi@0 83 PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
aoqi@0 84 return new ProfilePackageWriterImpl(configuration, packageDoc,
aoqi@0 85 prevPkg, nextPkg, profile);
aoqi@0 86 }
aoqi@0 87
aoqi@0 88 /**
aoqi@0 89 * {@inheritDoc}
aoqi@0 90 */
aoqi@0 91 public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
aoqi@0 92 ClassDoc nextClass, ClassTree classTree) throws IOException {
aoqi@0 93 return new ClassWriterImpl(configuration, classDoc,
aoqi@0 94 prevClass, nextClass, classTree);
aoqi@0 95 }
aoqi@0 96
aoqi@0 97 /**
aoqi@0 98 * {@inheritDoc}
aoqi@0 99 */
aoqi@0 100 public AnnotationTypeWriter getAnnotationTypeWriter(
aoqi@0 101 AnnotationTypeDoc annotationType, Type prevType, Type nextType)
aoqi@0 102 throws Exception {
aoqi@0 103 return new AnnotationTypeWriterImpl(configuration,
aoqi@0 104 annotationType, prevType, nextType);
aoqi@0 105 }
aoqi@0 106
aoqi@0 107 /**
aoqi@0 108 * {@inheritDoc}
aoqi@0 109 */
aoqi@0 110 public AnnotationTypeFieldWriter
aoqi@0 111 getAnnotationTypeFieldWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
aoqi@0 112 return new AnnotationTypeFieldWriterImpl(
aoqi@0 113 (SubWriterHolderWriter) annotationTypeWriter,
aoqi@0 114 annotationTypeWriter.getAnnotationTypeDoc());
aoqi@0 115 }
aoqi@0 116
aoqi@0 117 /**
aoqi@0 118 * {@inheritDoc}
aoqi@0 119 */
aoqi@0 120 public AnnotationTypeOptionalMemberWriter
aoqi@0 121 getAnnotationTypeOptionalMemberWriter(
aoqi@0 122 AnnotationTypeWriter annotationTypeWriter) throws Exception {
aoqi@0 123 return new AnnotationTypeOptionalMemberWriterImpl(
aoqi@0 124 (SubWriterHolderWriter) annotationTypeWriter,
aoqi@0 125 annotationTypeWriter.getAnnotationTypeDoc());
aoqi@0 126 }
aoqi@0 127
aoqi@0 128 /**
aoqi@0 129 * {@inheritDoc}
aoqi@0 130 */
aoqi@0 131 public AnnotationTypeRequiredMemberWriter
aoqi@0 132 getAnnotationTypeRequiredMemberWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
aoqi@0 133 return new AnnotationTypeRequiredMemberWriterImpl(
aoqi@0 134 (SubWriterHolderWriter) annotationTypeWriter,
aoqi@0 135 annotationTypeWriter.getAnnotationTypeDoc());
aoqi@0 136 }
aoqi@0 137
aoqi@0 138 /**
aoqi@0 139 * {@inheritDoc}
aoqi@0 140 */
aoqi@0 141 public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter)
aoqi@0 142 throws Exception {
aoqi@0 143 return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter,
aoqi@0 144 classWriter.getClassDoc());
aoqi@0 145 }
aoqi@0 146
aoqi@0 147 /**
aoqi@0 148 * {@inheritDoc}
aoqi@0 149 */
aoqi@0 150 public FieldWriterImpl getFieldWriter(ClassWriter classWriter)
aoqi@0 151 throws Exception {
aoqi@0 152 return new FieldWriterImpl((SubWriterHolderWriter) classWriter,
aoqi@0 153 classWriter.getClassDoc());
aoqi@0 154 }
aoqi@0 155
aoqi@0 156 /**
aoqi@0 157 * {@inheritDoc}
aoqi@0 158 */
aoqi@0 159 public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter)
aoqi@0 160 throws Exception {
aoqi@0 161 return new PropertyWriterImpl((SubWriterHolderWriter) classWriter,
aoqi@0 162 classWriter.getClassDoc());
aoqi@0 163 }
aoqi@0 164
aoqi@0 165 /**
aoqi@0 166 * {@inheritDoc}
aoqi@0 167 */
aoqi@0 168 public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
aoqi@0 169 throws Exception {
aoqi@0 170 return new MethodWriterImpl((SubWriterHolderWriter) classWriter,
aoqi@0 171 classWriter.getClassDoc());
aoqi@0 172 }
aoqi@0 173
aoqi@0 174 /**
aoqi@0 175 * {@inheritDoc}
aoqi@0 176 */
aoqi@0 177 public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter)
aoqi@0 178 throws Exception {
aoqi@0 179 return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
aoqi@0 180 classWriter.getClassDoc());
aoqi@0 181 }
aoqi@0 182
aoqi@0 183 /**
aoqi@0 184 * {@inheritDoc}
aoqi@0 185 */
aoqi@0 186 public MemberSummaryWriter getMemberSummaryWriter(
aoqi@0 187 ClassWriter classWriter, int memberType)
aoqi@0 188 throws Exception {
aoqi@0 189 switch (memberType) {
aoqi@0 190 case VisibleMemberMap.CONSTRUCTORS:
aoqi@0 191 return getConstructorWriter(classWriter);
aoqi@0 192 case VisibleMemberMap.ENUM_CONSTANTS:
aoqi@0 193 return getEnumConstantWriter(classWriter);
aoqi@0 194 case VisibleMemberMap.FIELDS:
aoqi@0 195 return getFieldWriter(classWriter);
aoqi@0 196 case VisibleMemberMap.PROPERTIES:
aoqi@0 197 return getPropertyWriter(classWriter);
aoqi@0 198 case VisibleMemberMap.INNERCLASSES:
aoqi@0 199 return new NestedClassWriterImpl((SubWriterHolderWriter)
aoqi@0 200 classWriter, classWriter.getClassDoc());
aoqi@0 201 case VisibleMemberMap.METHODS:
aoqi@0 202 return getMethodWriter(classWriter);
aoqi@0 203 default:
aoqi@0 204 return null;
aoqi@0 205 }
aoqi@0 206 }
aoqi@0 207
aoqi@0 208 /**
aoqi@0 209 * {@inheritDoc}
aoqi@0 210 */
aoqi@0 211 public MemberSummaryWriter getMemberSummaryWriter(
aoqi@0 212 AnnotationTypeWriter annotationTypeWriter, int memberType)
aoqi@0 213 throws Exception {
aoqi@0 214 switch (memberType) {
aoqi@0 215 case VisibleMemberMap.ANNOTATION_TYPE_FIELDS:
aoqi@0 216 return (AnnotationTypeFieldWriterImpl)
aoqi@0 217 getAnnotationTypeFieldWriter(annotationTypeWriter);
aoqi@0 218 case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL:
aoqi@0 219 return (AnnotationTypeOptionalMemberWriterImpl)
aoqi@0 220 getAnnotationTypeOptionalMemberWriter(annotationTypeWriter);
aoqi@0 221 case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED:
aoqi@0 222 return (AnnotationTypeRequiredMemberWriterImpl)
aoqi@0 223 getAnnotationTypeRequiredMemberWriter(annotationTypeWriter);
aoqi@0 224 default:
aoqi@0 225 return null;
aoqi@0 226 }
aoqi@0 227 }
aoqi@0 228
aoqi@0 229 /**
aoqi@0 230 * {@inheritDoc}
aoqi@0 231 */
aoqi@0 232 public SerializedFormWriter getSerializedFormWriter() throws Exception {
aoqi@0 233 return new SerializedFormWriterImpl(configuration);
aoqi@0 234 }
aoqi@0 235 }

mercurial