DocTreeVisitor.java revision 2571:10fc81ac75b4
1/*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
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
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
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 *
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.
24 */
25
26package com.sun.source.doctree;
27
28
29/**
30 * A visitor of trees, in the style of the visitor design pattern.
31 * Classes implementing this interface are used to operate
32 * on a tree when the kind of tree is unknown at compile time.
33 * When a visitor is passed to an tree's {@link DocTree#accept
34 * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
35 * to that tree is invoked.
36 *
37 * <p> Classes implementing this interface may or may not throw a
38 * {@code NullPointerException} if the additional parameter {@code p}
39 * is {@code null}; see documentation of the implementing class for
40 * details.
41 *
42 * <p> <b>WARNING:</b> It is possible that methods will be added to
43 * this interface to accommodate new, currently unknown, doc comment
44 * structures added to future versions of the Java&trade; programming
45 * language.  Therefore, visitor classes directly implementing this
46 * interface may be source incompatible with future versions of the
47 * platform.
48 *
49 * @param <R> the return type of this visitor's methods.  Use {@link
50 *            Void} for visitors that do not need to return results.
51 * @param <P> the type of the additional parameter to this visitor's
52 *            methods.  Use {@code Void} for visitors that do not need an
53 *            additional parameter.
54 *
55 * @since 1.8
56 */
57@jdk.Exported
58public interface DocTreeVisitor<R,P> {
59
60    /**
61     * Visits an AttributeTree node.
62     * @param node the node being visited
63     * @param p a parameter value
64     * @return a result value
65     */
66    R visitAttribute(AttributeTree node, P p);
67
68    /**
69     * Visits an AuthorTree node.
70     * @param node the node being visited
71     * @param p a parameter value
72     * @return a result value
73     */
74    R visitAuthor(AuthorTree node, P p);
75
76    /**
77     * Visits a CommentTree node.
78     * @param node the node being visited
79     * @param p a parameter value
80     * @return a result value
81     */
82    R visitComment(CommentTree node, P p);
83
84    /**
85     * Visits a DeprecatedTree node.
86     * @param node the node being visited
87     * @param p a parameter value
88     * @return a result value
89     */
90    R visitDeprecated(DeprecatedTree node, P p);
91
92    /**
93     * Visits a DocCommentTree node.
94     * @param node the node being visited
95     * @param p a parameter value
96     * @return a result value
97     */
98    R visitDocComment(DocCommentTree node, P p);
99
100    /**
101     * Visits a DocRootTree node.
102     * @param node the node being visited
103     * @param p a parameter value
104     * @return a result value
105     */
106    R visitDocRoot(DocRootTree node, P p);
107
108    /**
109     * Visits an EndElementTree node.
110     * @param node the node being visited
111     * @param p a parameter value
112     * @return a result value
113     */
114    R visitEndElement(EndElementTree node, P p);
115
116    /**
117     * Visits an EntityTree node.
118     * @param node the node being visited
119     * @param p a parameter value
120     * @return a result value
121     */
122    R visitEntity(EntityTree node, P p);
123
124    /**
125     * Visits an ErroneousTree node.
126     * @param node the node being visited
127     * @param p a parameter value
128     * @return a result value
129     */
130    R visitErroneous(ErroneousTree node, P p);
131
132    /**
133     * Visits an IdentifierTree node.
134     * @param node the node being visited
135     * @param p a parameter value
136     * @return a result value
137     */
138    R visitIdentifier(IdentifierTree node, P p);
139
140    /**
141     * Visits an InheritDocTree node.
142     * @param node the node being visited
143     * @param p a parameter value
144     * @return a result value
145     */
146    R visitInheritDoc(InheritDocTree node, P p);
147
148    /**
149     * Visits a LinkTree node.
150     * @param node the node being visited
151     * @param p a parameter value
152     * @return a result value
153     */
154    R visitLink(LinkTree node, P p);
155
156    /**
157     * Visits an LiteralTree node.
158     * @param node the node being visited
159     * @param p a parameter value
160     * @return a result value
161     */
162    R visitLiteral(LiteralTree node, P p);
163
164    /**
165     * Visits a ParamTree node.
166     * @param node the node being visited
167     * @param p a parameter value
168     * @return a result value
169     */
170    R visitParam(ParamTree node, P p);
171
172    /**
173     * Visits a ReferenceTree node.
174     * @param node the node being visited
175     * @param p a parameter value
176     * @return a result value
177     */
178    R visitReference(ReferenceTree node, P p);
179
180    /**
181     * Visits a ReturnTree node.
182     * @param node the node being visited
183     * @param p a parameter value
184     * @return a result value
185     */
186    R visitReturn(ReturnTree node, P p);
187
188    /**
189     * Visits a SeeTree node.
190     * @param node the node being visited
191     * @param p a parameter value
192     * @return a result value
193     */
194    R visitSee(SeeTree node, P p);
195
196    /**
197     * Visits a SerialTree node.
198     * @param node the node being visited
199     * @param p a parameter value
200     * @return a result value
201     */
202    R visitSerial(SerialTree node, P p);
203
204    /**
205     * Visits a SerialDataTree node.
206     * @param node the node being visited
207     * @param p a parameter value
208     * @return a result value
209     */
210    R visitSerialData(SerialDataTree node, P p);
211
212    /**
213     * Visits a SerialFieldTree node.
214     * @param node the node being visited
215     * @param p a parameter value
216     * @return a result value
217     */
218    R visitSerialField(SerialFieldTree node, P p);
219
220    /**
221     * Visits a SinceTree node.
222     * @param node the node being visited
223     * @param p a parameter value
224     * @return a result value
225     */
226    R visitSince(SinceTree node, P p);
227
228    /**
229     * Visits a StartElementTree node.
230     * @param node the node being visited
231     * @param p a parameter value
232     * @return a result value
233     */
234    R visitStartElement(StartElementTree node, P p);
235
236    /**
237     * Visits a TextTree node.
238     * @param node the node being visited
239     * @param p a parameter value
240     * @return a result value
241     */
242    R visitText(TextTree node, P p);
243
244    /**
245     * Visits a ThrowsTree node.
246     * @param node the node being visited
247     * @param p a parameter value
248     * @return a result value
249     */
250    R visitThrows(ThrowsTree node, P p);
251
252    /**
253     * Visits an UnknownBlockTagTree node.
254     * @param node the node being visited
255     * @param p a parameter value
256     * @return a result value
257     */
258    R visitUnknownBlockTag(UnknownBlockTagTree node, P p);
259
260    /**
261     * Visits an UnknownInlineTagTree node.
262     * @param node the node being visited
263     * @param p a parameter value
264     * @return a result value
265     */
266    R visitUnknownInlineTag(UnknownInlineTagTree node, P p);
267
268    /**
269     * Visits a ValueTree node.
270     * @param node the node being visited
271     * @param p a parameter value
272     * @return a result value
273     */
274    R visitValue(ValueTree node, P p);
275
276    /**
277     * Visits a VersionTreeTree node.
278     * @param node the node being visited
279     * @param p a parameter value
280     * @return a result value
281     */
282    R visitVersion(VersionTree node, P p);
283
284    /**
285     * Visits an unknown type of DocTree node.
286     * This can occur if the set of tags evolves and new kinds
287     * of nodes are added to the {@code DocTree} hierarchy.
288     * @param node the node being visited
289     * @param p a parameter value
290     * @return a result value
291     */
292    R visitOther(DocTree node, P p);
293}
294