forked from openjdk/jdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DocTree.java
311 lines (265 loc) · 8.27 KB
/
DocTree.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
/*
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.source.doctree;
/**
* Common interface for all nodes in a documentation syntax tree.
*
* @since 1.8
*/
public interface DocTree {
/**
* Enumerates all kinds of trees.
*/
enum Kind {
/**
* Used for instances of {@link AttributeTree}
* representing an attribute in an HTML element or tag.
*/
ATTRIBUTE,
/**
* Used for instances of {@link AuthorTree}
* representing an {@code @author} tag.
*/
AUTHOR("author"),
/**
* Used for instances of {@link LiteralTree}
* representing an {@code @code} tag.
*/
CODE("code"),
/**
* Used for instances of {@link CommentTree}
* representing an HTML comment.
*/
COMMENT,
/**
* Used for instances of {@link DeprecatedTree}
* representing an {@code @deprecated} tag.
*/
DEPRECATED("deprecated"),
/**
* Used for instances of {@link DocCommentTree}
* representing a complete doc comment.
*/
DOC_COMMENT,
/**
* Used for instances of {@link DocRootTree}
* representing an {@code @docRoot} tag.
*/
DOC_ROOT("docRoot"),
/**
* Used for instances of {@link DocTypeTree}
* representing an HTML DocType declaration.
*/
DOC_TYPE,
/**
* Used for instances of {@link EndElementTree}
* representing the end of an HTML element.
*/
END_ELEMENT,
/**
* Used for instances of {@link EntityTree}
* representing an HTML entity.
*/
ENTITY,
/**
* Used for instances of {@link ErroneousTree}
* representing some invalid text.
*/
ERRONEOUS,
/**
* Used for instances of {@link ThrowsTree}
* representing an {@code @exception} tag.
*/
EXCEPTION("exception"),
/**
* Used for instances of {@link HiddenTree}
* representing an {@code @hidden} tag.
*/
HIDDEN("hidden"),
/**
* Used for instances of {@link IdentifierTree}
* representing an identifier.
*/
IDENTIFIER,
/**
* Used for instances of {@link IndexTree}
* representing an {@code @index} tag.
*/
INDEX("index"),
/**
* Used for instances of {@link InheritDocTree}
* representing an {@code @inheritDoc} tag.
*/
INHERIT_DOC("inheritDoc"),
/**
* Used for instances of {@link LinkTree}
* representing an {@code @link} tag.
*/
LINK("link"),
/**
* Used for instances of {@link LinkTree}
* representing an {@code @linkplain} tag.
*/
LINK_PLAIN("linkplain"),
/**
* Used for instances of {@link LiteralTree}
* representing an {@code @literal} tag.
*/
LITERAL("literal"),
/**
* Used for instances of {@link ParamTree}
* representing an {@code @param} tag.
*/
PARAM("param"),
/**
* Used for instances of {@link ProvidesTree}
* representing an {@code @provides} tag.
*/
PROVIDES("provides"),
/**
* Used for instances of {@link ReferenceTree}
* representing a reference to an element in the
* Java programming language.
*/
REFERENCE,
/**
* Used for instances of {@link ReturnTree}
* representing an {@code @return} tag.
*/
RETURN("return"),
/**
* Used for instances of {@link SeeTree}
* representing an {@code @see} tag.
*/
SEE("see"),
/**
* Used for instances of {@link SerialTree}
* representing an {@code @serial} tag.
*/
SERIAL("serial"),
/**
* Used for instances of {@link SerialDataTree}
* representing an {@code @serialData} tag.
*/
SERIAL_DATA("serialData"),
/**
* Used for instances of {@link SerialFieldTree}
* representing an {@code @serialField} tag.
*/
SERIAL_FIELD("serialField"),
/**
* Used for instances of {@link SinceTree}
* representing an {@code @since} tag.
*/
SINCE("since"),
/**
* Used for instances of {@link SnippetTree}
* representing an {@code @snippet} tag.
*/
SNIPPET("snippet"),
/**
* Used for instances of {@link EndElementTree}
* representing the start of an HTML element.
*/
START_ELEMENT,
/**
* Used for instances of {@link SystemPropertyTree}
* representing an {@code @systemProperty} tag.
*/
SYSTEM_PROPERTY("systemProperty"),
/**
* Used for instances of {@link SummaryTree}
* representing an {@code @summary} tag.
*/
SUMMARY("summary"),
/**
* Used for instances of {@link TextTree}
* representing some documentation text.
*/
TEXT,
/**
* Used for instances of {@link ThrowsTree}
* representing an {@code @throws} tag.
*/
THROWS("throws"),
/**
* Used for instances of {@link UnknownBlockTagTree}
* representing an unknown block tag.
*/
UNKNOWN_BLOCK_TAG,
/**
* Used for instances of {@link UnknownInlineTagTree}
* representing an unknown inline tag.
*/
UNKNOWN_INLINE_TAG,
/**
* Used for instances of {@link UsesTree}
* representing an {@code @uses} tag.
*/
USES("uses"),
/**
* Used for instances of {@link ValueTree}
* representing an {@code @value} tag.
*/
VALUE("value"),
/**
* Used for instances of {@link VersionTree}
* representing an {@code @version} tag.
*/
VERSION("version"),
/**
* An implementation-reserved node. This is the not the node
* you are looking for.
*/
OTHER;
/**
* The name of the tag, if any, associated with this kind of node.
*/
public final String tagName;
Kind() {
tagName = null;
}
Kind(String tagName) {
this.tagName = tagName;
}
}
/**
* Returns the kind of this tree.
*
* @return the kind of this tree
*/
Kind getKind();
/**
* Accept method used to implement the visitor pattern. The
* visitor pattern is used to implement operations on trees.
*
* @param <R> the result type of this operation
* @param <D> the type of additional data
* @param visitor the visitor to be called
* @param data a parameter value to be passed to the visitor method
* @return the value returned from the visitor method
*/
<R, D> R accept(DocTreeVisitor<R,D> visitor, D data);
}