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

Thu, 15 Nov 2012 19:54:20 -0800

author
jjg
date
Thu, 15 Nov 2012 19:54:20 -0800
changeset 1412
400a4e8accd3
parent 1410
bfec2a1cc869
child 1568
5f0731e4e5e6
permissions
-rw-r--r--

8002079: update DocFile to use a JavaFileManager
Reviewed-by: darcy

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

mercurial