author | jjg |
Mon, 22 Aug 2016 16:32:40 -0700 | |
changeset 40587 | 1c355ea550ed |
parent 36526 | 3b41f1c69604 |
child 45417 | f7479ee8de69 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
2 |
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
10 | 27 |
|
14542 | 28 |
|
36526 | 29 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
30 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
31 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
32 |
import javax.lang.model.type.TypeMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
33 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
34 |
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
35 |
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeOptionalMemberWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
36 |
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
37 |
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
38 |
import jdk.javadoc.internal.doclets.toolkit.ClassWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
39 |
import jdk.javadoc.internal.doclets.toolkit.ConstantsSummaryWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
40 |
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter; |
36526 | 41 |
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
42 |
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
43 |
import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.toolkit.WriterFactory; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
45 |
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
47 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
48 |
import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind.*; |
10 | 49 |
|
50 |
/** |
|
51 |
* The factory that returns HTML writers. |
|
52 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
53 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
54 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
55 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
56 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
57 |
* |
10 | 58 |
* @author Jamie Ho |
59 |
*/ |
|
60 |
public class WriterFactoryImpl implements WriterFactory { |
|
61 |
||
14542 | 62 |
private final ConfigurationImpl configuration; |
1475 | 63 |
public WriterFactoryImpl(ConfigurationImpl configuration) { |
10 | 64 |
this.configuration = configuration; |
65 |
} |
|
66 |
||
67 |
/** |
|
68 |
* {@inheritDoc} |
|
69 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
70 |
@Override |
40587 | 71 |
public ConstantsSummaryWriter getConstantsSummaryWriter() { |
10 | 72 |
return new ConstantsSummaryWriterImpl(configuration); |
73 |
} |
|
74 |
||
75 |
/** |
|
76 |
* {@inheritDoc} |
|
77 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
78 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
79 |
public PackageSummaryWriter getPackageSummaryWriter(PackageElement packageElement, |
40587 | 80 |
PackageElement prevPkg, PackageElement nextPkg) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
81 |
return new PackageWriterImpl(configuration, packageElement, prevPkg, nextPkg); |
10 | 82 |
} |
83 |
||
84 |
/** |
|
85 |
* {@inheritDoc} |
|
86 |
*/ |
|
36526 | 87 |
public ModuleSummaryWriter getModuleSummaryWriter(ModuleElement mdle, |
40587 | 88 |
ModuleElement prevModule, ModuleElement nextModule) { |
36526 | 89 |
return new ModuleWriterImpl(configuration, mdle, |
90 |
prevModule, nextModule); |
|
91 |
} |
|
92 |
||
93 |
/** |
|
94 |
* {@inheritDoc} |
|
95 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
96 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
97 |
public ClassWriter getClassWriter(TypeElement typeElement, TypeElement prevClass, |
40587 | 98 |
TypeElement nextClass, ClassTree classTree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
99 |
return new ClassWriterImpl(configuration, typeElement, prevClass, nextClass, classTree); |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
100 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
101 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
102 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
103 |
* {@inheritDoc} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
104 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
105 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
106 |
public AnnotationTypeWriter getAnnotationTypeWriter(TypeElement annotationType, |
40587 | 107 |
TypeMirror prevType, TypeMirror nextType) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
108 |
return new AnnotationTypeWriterImpl(configuration, annotationType, prevType, nextType); |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
109 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
110 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
111 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
112 |
* {@inheritDoc} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14542
diff
changeset
|
113 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
114 |
@Override |
40587 | 115 |
public AnnotationTypeFieldWriter getAnnotationTypeFieldWriter( |
116 |
AnnotationTypeWriter annotationTypeWriter) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
117 |
TypeElement te = annotationTypeWriter.getAnnotationTypeElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
118 |
return new AnnotationTypeFieldWriterImpl( |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
119 |
(SubWriterHolderWriter) annotationTypeWriter, te); |
10 | 120 |
} |
121 |
||
122 |
/** |
|
123 |
* {@inheritDoc} |
|
124 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
125 |
@Override |
40587 | 126 |
public AnnotationTypeOptionalMemberWriter getAnnotationTypeOptionalMemberWriter( |
127 |
AnnotationTypeWriter annotationTypeWriter) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
128 |
TypeElement te = annotationTypeWriter.getAnnotationTypeElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
129 |
return new AnnotationTypeOptionalMemberWriterImpl( |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
130 |
(SubWriterHolderWriter) annotationTypeWriter, te); |
10 | 131 |
} |
132 |
||
133 |
/** |
|
134 |
* {@inheritDoc} |
|
135 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
136 |
@Override |
40587 | 137 |
public AnnotationTypeRequiredMemberWriter getAnnotationTypeRequiredMemberWriter( |
138 |
AnnotationTypeWriter annotationTypeWriter) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
139 |
TypeElement te = annotationTypeWriter.getAnnotationTypeElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
140 |
return new AnnotationTypeRequiredMemberWriterImpl( |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
141 |
(SubWriterHolderWriter) annotationTypeWriter, te); |
10 | 142 |
} |
143 |
||
144 |
/** |
|
145 |
* {@inheritDoc} |
|
146 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
147 |
@Override |
40587 | 148 |
public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
149 |
return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
150 |
classWriter.getTypeElement()); |
10 | 151 |
} |
152 |
||
153 |
/** |
|
154 |
* {@inheritDoc} |
|
155 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
156 |
@Override |
40587 | 157 |
public FieldWriterImpl getFieldWriter(ClassWriter classWriter) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
158 |
return new FieldWriterImpl((SubWriterHolderWriter) classWriter, classWriter.getTypeElement()); |
10 | 159 |
} |
160 |
||
161 |
/** |
|
162 |
* {@inheritDoc} |
|
163 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
164 |
@Override |
40587 | 165 |
public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
166 |
return new PropertyWriterImpl((SubWriterHolderWriter) classWriter, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
167 |
classWriter.getTypeElement()); |
10 | 168 |
} |
169 |
||
170 |
/** |
|
171 |
* {@inheritDoc} |
|
172 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
173 |
@Override |
40587 | 174 |
public MethodWriterImpl getMethodWriter(ClassWriter classWriter) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
175 |
return new MethodWriterImpl((SubWriterHolderWriter) classWriter, classWriter.getTypeElement()); |
10 | 176 |
} |
177 |
||
178 |
/** |
|
179 |
* {@inheritDoc} |
|
180 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
181 |
@Override |
40587 | 182 |
public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter) { |
10 | 183 |
return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
184 |
classWriter.getTypeElement()); |
10 | 185 |
} |
186 |
||
187 |
/** |
|
188 |
* {@inheritDoc} |
|
189 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
190 |
@Override |
40587 | 191 |
public MemberSummaryWriter getMemberSummaryWriter(ClassWriter classWriter, |
192 |
VisibleMemberMap.Kind memberType) { |
|
10 | 193 |
switch (memberType) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
194 |
case CONSTRUCTORS: |
14542 | 195 |
return getConstructorWriter(classWriter); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
196 |
case ENUM_CONSTANTS: |
14542 | 197 |
return getEnumConstantWriter(classWriter); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
198 |
case FIELDS: |
14542 | 199 |
return getFieldWriter(classWriter); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
200 |
case PROPERTIES: |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15723
diff
changeset
|
201 |
return getPropertyWriter(classWriter); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
202 |
case INNER_CLASSES: |
10 | 203 |
return new NestedClassWriterImpl((SubWriterHolderWriter) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
204 |
classWriter, classWriter.getTypeElement()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
205 |
case METHODS: |
14542 | 206 |
return getMethodWriter(classWriter); |
10 | 207 |
default: |
208 |
return null; |
|
209 |
} |
|
210 |
} |
|
211 |
||
212 |
/** |
|
213 |
* {@inheritDoc} |
|
214 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
215 |
@Override |
40587 | 216 |
public MemberSummaryWriter getMemberSummaryWriter(AnnotationTypeWriter annotationTypeWriter, |
217 |
VisibleMemberMap.Kind memberType) { |
|
10 | 218 |
switch (memberType) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
219 |
case ANNOTATION_TYPE_FIELDS: |
20237
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
16319
diff
changeset
|
220 |
return (AnnotationTypeFieldWriterImpl) |
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
16319
diff
changeset
|
221 |
getAnnotationTypeFieldWriter(annotationTypeWriter); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
222 |
case ANNOTATION_TYPE_MEMBER_OPTIONAL: |
10 | 223 |
return (AnnotationTypeOptionalMemberWriterImpl) |
224 |
getAnnotationTypeOptionalMemberWriter(annotationTypeWriter); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
225 |
case ANNOTATION_TYPE_MEMBER_REQUIRED: |
10 | 226 |
return (AnnotationTypeRequiredMemberWriterImpl) |
227 |
getAnnotationTypeRequiredMemberWriter(annotationTypeWriter); |
|
228 |
default: |
|
229 |
return null; |
|
230 |
} |
|
231 |
} |
|
232 |
||
233 |
/** |
|
234 |
* {@inheritDoc} |
|
235 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
236 |
@Override |
40587 | 237 |
public SerializedFormWriter getSerializedFormWriter() { |
14542 | 238 |
return new SerializedFormWriterImpl(configuration); |
10 | 239 |
} |
240 |
} |