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

Tue, 14 May 2013 10:14:53 -0700

author
jjg
date
Tue, 14 May 2013 10:14:53 -0700
changeset 1740
ce4f0769b4b2
parent 1606
ccbe7ffdd867
child 2035
a2a5ad0853ed
permissions
-rw-r--r--

8011668: Allow HTMLWriter.getResource to take Content args
Reviewed-by: darcy

duke@1 1 /*
bpatel@1568 2 * Copyright (c) 2003, 2013, 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.formats.html;
duke@1 27
jjg@1410 28 import java.io.IOException;
jjg@1410 29
jjg@1357 30 import com.sun.javadoc.*;
bpatel@1568 31 import com.sun.tools.javac.jvm.Profile;
duke@1 32 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 33 import com.sun.tools.doclets.internal.toolkit.util.*;
duke@1 34
duke@1 35 /**
duke@1 36 * The factory that returns HTML writers.
duke@1 37 *
jjg@1359 38 * <p><b>This is NOT part of any supported API.
jjg@1359 39 * If you write code that depends on this, you do so at your own risk.
jjg@1359 40 * This code and its internal interfaces are subject to change or
jjg@1359 41 * deletion without notice.</b>
jjg@1359 42 *
duke@1 43 * @author Jamie Ho
duke@1 44 * @since 1.5
duke@1 45 */
duke@1 46 public class WriterFactoryImpl implements WriterFactory {
duke@1 47
jjg@1410 48 private final ConfigurationImpl configuration;
duke@1 49
jjg@140 50 public WriterFactoryImpl(ConfigurationImpl configuration) {
duke@1 51 this.configuration = configuration;
duke@1 52 }
duke@1 53
duke@1 54 /**
duke@1 55 * {@inheritDoc}
duke@1 56 */
duke@1 57 public ConstantsSummaryWriter getConstantsSummaryWriter() throws Exception {
duke@1 58 return new ConstantsSummaryWriterImpl(configuration);
duke@1 59 }
duke@1 60
duke@1 61 /**
duke@1 62 * {@inheritDoc}
duke@1 63 */
duke@1 64 public PackageSummaryWriter getPackageSummaryWriter(PackageDoc packageDoc,
duke@1 65 PackageDoc prevPkg, PackageDoc nextPkg) throws Exception {
jjg@1410 66 return new PackageWriterImpl(configuration, packageDoc,
duke@1 67 prevPkg, nextPkg);
duke@1 68 }
duke@1 69
duke@1 70 /**
duke@1 71 * {@inheritDoc}
duke@1 72 */
bpatel@1568 73 public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
bpatel@1568 74 Profile prevProfile, Profile nextProfile) throws Exception {
bpatel@1568 75 return new ProfileWriterImpl(configuration, profile,
bpatel@1568 76 prevProfile, nextProfile);
bpatel@1568 77 }
bpatel@1568 78
bpatel@1568 79 /**
bpatel@1568 80 * {@inheritDoc}
bpatel@1568 81 */
bpatel@1568 82 public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
bpatel@1568 83 PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
bpatel@1568 84 return new ProfilePackageWriterImpl(configuration, packageDoc,
bpatel@1568 85 prevPkg, nextPkg, profile);
bpatel@1568 86 }
bpatel@1568 87
bpatel@1568 88 /**
bpatel@1568 89 * {@inheritDoc}
bpatel@1568 90 */
duke@1 91 public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
jjg@1410 92 ClassDoc nextClass, ClassTree classTree) throws IOException {
jjg@1410 93 return new ClassWriterImpl(configuration, classDoc,
jjg@1410 94 prevClass, nextClass, classTree);
duke@1 95 }
duke@1 96
duke@1 97 /**
duke@1 98 * {@inheritDoc}
duke@1 99 */
duke@1 100 public AnnotationTypeWriter getAnnotationTypeWriter(
duke@1 101 AnnotationTypeDoc annotationType, Type prevType, Type nextType)
duke@1 102 throws Exception {
jjg@1410 103 return new AnnotationTypeWriterImpl(configuration,
jjg@1410 104 annotationType, prevType, nextType);
duke@1 105 }
duke@1 106
duke@1 107 /**
duke@1 108 * {@inheritDoc}
duke@1 109 */
duke@1 110 public AnnotationTypeOptionalMemberWriter
duke@1 111 getAnnotationTypeOptionalMemberWriter(
duke@1 112 AnnotationTypeWriter annotationTypeWriter) throws Exception {
duke@1 113 return new AnnotationTypeOptionalMemberWriterImpl(
duke@1 114 (SubWriterHolderWriter) annotationTypeWriter,
duke@1 115 annotationTypeWriter.getAnnotationTypeDoc());
duke@1 116 }
duke@1 117
duke@1 118 /**
duke@1 119 * {@inheritDoc}
duke@1 120 */
duke@1 121 public AnnotationTypeRequiredMemberWriter
duke@1 122 getAnnotationTypeRequiredMemberWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
duke@1 123 return new AnnotationTypeRequiredMemberWriterImpl(
duke@1 124 (SubWriterHolderWriter) annotationTypeWriter,
duke@1 125 annotationTypeWriter.getAnnotationTypeDoc());
duke@1 126 }
duke@1 127
duke@1 128 /**
duke@1 129 * {@inheritDoc}
duke@1 130 */
jjg@1410 131 public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter)
duke@1 132 throws Exception {
duke@1 133 return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter,
duke@1 134 classWriter.getClassDoc());
duke@1 135 }
duke@1 136
duke@1 137 /**
duke@1 138 * {@inheritDoc}
duke@1 139 */
jjg@1410 140 public FieldWriterImpl getFieldWriter(ClassWriter classWriter)
duke@1 141 throws Exception {
duke@1 142 return new FieldWriterImpl((SubWriterHolderWriter) classWriter,
duke@1 143 classWriter.getClassDoc());
duke@1 144 }
duke@1 145
duke@1 146 /**
duke@1 147 * {@inheritDoc}
duke@1 148 */
jjg@1606 149 public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter)
jjg@1606 150 throws Exception {
jjg@1606 151 return new PropertyWriterImpl((SubWriterHolderWriter) classWriter,
jjg@1606 152 classWriter.getClassDoc());
jjg@1606 153 }
jjg@1606 154
jjg@1606 155 /**
jjg@1606 156 * {@inheritDoc}
jjg@1606 157 */
jjg@1410 158 public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
duke@1 159 throws Exception {
duke@1 160 return new MethodWriterImpl((SubWriterHolderWriter) classWriter,
duke@1 161 classWriter.getClassDoc());
duke@1 162 }
duke@1 163
duke@1 164 /**
duke@1 165 * {@inheritDoc}
duke@1 166 */
jjg@1410 167 public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter)
duke@1 168 throws Exception {
duke@1 169 return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
duke@1 170 classWriter.getClassDoc());
duke@1 171 }
duke@1 172
duke@1 173 /**
duke@1 174 * {@inheritDoc}
duke@1 175 */
duke@1 176 public MemberSummaryWriter getMemberSummaryWriter(
jjg@1410 177 ClassWriter classWriter, int memberType)
jjg@1410 178 throws Exception {
duke@1 179 switch (memberType) {
duke@1 180 case VisibleMemberMap.CONSTRUCTORS:
jjg@1410 181 return getConstructorWriter(classWriter);
duke@1 182 case VisibleMemberMap.ENUM_CONSTANTS:
jjg@1410 183 return getEnumConstantWriter(classWriter);
duke@1 184 case VisibleMemberMap.FIELDS:
jjg@1410 185 return getFieldWriter(classWriter);
jjg@1606 186 case VisibleMemberMap.PROPERTIES:
jjg@1606 187 return getPropertyWriter(classWriter);
duke@1 188 case VisibleMemberMap.INNERCLASSES:
duke@1 189 return new NestedClassWriterImpl((SubWriterHolderWriter)
duke@1 190 classWriter, classWriter.getClassDoc());
duke@1 191 case VisibleMemberMap.METHODS:
jjg@1410 192 return getMethodWriter(classWriter);
duke@1 193 default:
duke@1 194 return null;
duke@1 195 }
duke@1 196 }
duke@1 197
duke@1 198 /**
duke@1 199 * {@inheritDoc}
duke@1 200 */
duke@1 201 public MemberSummaryWriter getMemberSummaryWriter(
duke@1 202 AnnotationTypeWriter annotationTypeWriter, int memberType)
duke@1 203 throws Exception {
duke@1 204 switch (memberType) {
duke@1 205 case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL:
duke@1 206 return (AnnotationTypeOptionalMemberWriterImpl)
duke@1 207 getAnnotationTypeOptionalMemberWriter(annotationTypeWriter);
duke@1 208 case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED:
duke@1 209 return (AnnotationTypeRequiredMemberWriterImpl)
duke@1 210 getAnnotationTypeRequiredMemberWriter(annotationTypeWriter);
duke@1 211 default:
duke@1 212 return null;
duke@1 213 }
duke@1 214 }
duke@1 215
duke@1 216 /**
duke@1 217 * {@inheritDoc}
duke@1 218 */
duke@1 219 public SerializedFormWriter getSerializedFormWriter() throws Exception {
jjg@1410 220 return new SerializedFormWriterImpl(configuration);
duke@1 221 }
duke@1 222 }

mercurial