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

Mon, 21 Jan 2013 00:45:35 -0500

author
bpatel
date
Mon, 21 Jan 2013 00:45:35 -0500
changeset 1568
5f0731e4e5e6
parent 1410
bfec2a1cc869
child 1606
ccbe7ffdd867
permissions
-rw-r--r--

8006124: javadoc/doclet should be updated to support profiles
Reviewed-by: jjg

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@1410 149 public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
duke@1 150 throws Exception {
duke@1 151 return new MethodWriterImpl((SubWriterHolderWriter) classWriter,
duke@1 152 classWriter.getClassDoc());
duke@1 153 }
duke@1 154
duke@1 155 /**
duke@1 156 * {@inheritDoc}
duke@1 157 */
jjg@1410 158 public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter)
duke@1 159 throws Exception {
duke@1 160 return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
duke@1 161 classWriter.getClassDoc());
duke@1 162 }
duke@1 163
duke@1 164 /**
duke@1 165 * {@inheritDoc}
duke@1 166 */
duke@1 167 public MemberSummaryWriter getMemberSummaryWriter(
jjg@1410 168 ClassWriter classWriter, int memberType)
jjg@1410 169 throws Exception {
duke@1 170 switch (memberType) {
duke@1 171 case VisibleMemberMap.CONSTRUCTORS:
jjg@1410 172 return getConstructorWriter(classWriter);
duke@1 173 case VisibleMemberMap.ENUM_CONSTANTS:
jjg@1410 174 return getEnumConstantWriter(classWriter);
duke@1 175 case VisibleMemberMap.FIELDS:
jjg@1410 176 return getFieldWriter(classWriter);
duke@1 177 case VisibleMemberMap.INNERCLASSES:
duke@1 178 return new NestedClassWriterImpl((SubWriterHolderWriter)
duke@1 179 classWriter, classWriter.getClassDoc());
duke@1 180 case VisibleMemberMap.METHODS:
jjg@1410 181 return getMethodWriter(classWriter);
duke@1 182 default:
duke@1 183 return null;
duke@1 184 }
duke@1 185 }
duke@1 186
duke@1 187 /**
duke@1 188 * {@inheritDoc}
duke@1 189 */
duke@1 190 public MemberSummaryWriter getMemberSummaryWriter(
duke@1 191 AnnotationTypeWriter annotationTypeWriter, int memberType)
duke@1 192 throws Exception {
duke@1 193 switch (memberType) {
duke@1 194 case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL:
duke@1 195 return (AnnotationTypeOptionalMemberWriterImpl)
duke@1 196 getAnnotationTypeOptionalMemberWriter(annotationTypeWriter);
duke@1 197 case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED:
duke@1 198 return (AnnotationTypeRequiredMemberWriterImpl)
duke@1 199 getAnnotationTypeRequiredMemberWriter(annotationTypeWriter);
duke@1 200 default:
duke@1 201 return null;
duke@1 202 }
duke@1 203 }
duke@1 204
duke@1 205 /**
duke@1 206 * {@inheritDoc}
duke@1 207 */
duke@1 208 public SerializedFormWriter getSerializedFormWriter() throws Exception {
jjg@1410 209 return new SerializedFormWriterImpl(configuration);
duke@1 210 }
duke@1 211 }

mercurial