DocTreeVisitor.java revision 3337:cba09a2e6ae9
18197Sjkh/*
28197Sjkh * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
38197Sjkh * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
48153Sphk *
58197Sjkh * This code is free software; you can redistribute it and/or modify it
68264Sphk * under the terms of the GNU General Public License version 2 only, as
78197Sjkh * published by the Free Software Foundation.  Oracle designates this
88197Sjkh * particular file as subject to the "Classpath" exception as provided
98197Sjkh * by Oracle in the LICENSE file that accompanied this code.
1014657Speter *
118179Sphk * This code is distributed in the hope that it will be useful, but WITHOUT
128197Sjkh * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
138197Sjkh * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
148233Sphk * version 2 for more details (a copy is included in the LICENSE file that
158153Sphk * accompanied this code).
168404Sphk *
178178Sphk * You should have received a copy of the GNU General Public License version
188178Sphk * 2 along with this work; if not, write to the Free Software Foundation,
198178Sphk * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
208178Sphk *
218197Sjkh * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
228178Sphk * or visit www.oracle.com if you need additional information or have any
238233Sphk * questions.
248233Sphk */
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 */
57public interface DocTreeVisitor<R,P> {
58
59    /**
60     * Visits an AttributeTree node.
61     * @param node the node being visited
62     * @param p a parameter value
63     * @return a result value
64     */
65    R visitAttribute(AttributeTree node, P p);
66
67    /**
68     * Visits an AuthorTree node.
69     * @param node the node being visited
70     * @param p a parameter value
71     * @return a result value
72     */
73    R visitAuthor(AuthorTree node, P p);
74
75    /**
76     * Visits a CommentTree node.
77     * @param node the node being visited
78     * @param p a parameter value
79     * @return a result value
80     */
81    R visitComment(CommentTree node, P p);
82
83    /**
84     * Visits a DeprecatedTree node.
85     * @param node the node being visited
86     * @param p a parameter value
87     * @return a result value
88     */
89    R visitDeprecated(DeprecatedTree node, P p);
90
91    /**
92     * Visits a DocCommentTree node.
93     * @param node the node being visited
94     * @param p a parameter value
95     * @return a result value
96     */
97    R visitDocComment(DocCommentTree node, P p);
98
99    /**
100     * Visits a DocRootTree node.
101     * @param node the node being visited
102     * @param p a parameter value
103     * @return a result value
104     */
105    R visitDocRoot(DocRootTree node, P p);
106
107    /**
108     * Visits an EndElementTree node.
109     * @param node the node being visited
110     * @param p a parameter value
111     * @return a result value
112     */
113    R visitEndElement(EndElementTree node, P p);
114
115    /**
116     * Visits an EntityTree node.
117     * @param node the node being visited
118     * @param p a parameter value
119     * @return a result value
120     */
121    R visitEntity(EntityTree node, P p);
122
123    /**
124     * Visits an ErroneousTree node.
125     * @param node the node being visited
126     * @param p a parameter value
127     * @return a result value
128     */
129    R visitErroneous(ErroneousTree node, P p);
130
131    /**
132     * Visits a HiddenTree node.
133     * @param node the node being visited
134     * @param p a parameter value
135     * @return a result value
136     */
137    R visitHidden(HiddenTree node, P p);
138
139    /**
140     * Visits an IdentifierTree node.
141     * @param node the node being visited
142     * @param p a parameter value
143     * @return a result value
144     */
145    R visitIdentifier(IdentifierTree node, P p);
146
147    /**
148     * Visits an IndexTree node.
149     * @param node the node being visited
150     * @param p a parameter value
151     * @return a result value
152     */
153    R visitIndex(IndexTree node, P p);
154
155    /**
156     * Visits an InheritDocTree node.
157     * @param node the node being visited
158     * @param p a parameter value
159     * @return a result value
160     */
161    R visitInheritDoc(InheritDocTree node, P p);
162
163    /**
164     * Visits a LinkTree node.
165     * @param node the node being visited
166     * @param p a parameter value
167     * @return a result value
168     */
169    R visitLink(LinkTree node, P p);
170
171    /**
172     * Visits an LiteralTree node.
173     * @param node the node being visited
174     * @param p a parameter value
175     * @return a result value
176     */
177    R visitLiteral(LiteralTree node, P p);
178
179    /**
180     * Visits a ParamTree node.
181     * @param node the node being visited
182     * @param p a parameter value
183     * @return a result value
184     */
185    R visitParam(ParamTree node, P p);
186
187    /**
188     * Visits a ReferenceTree node.
189     * @param node the node being visited
190     * @param p a parameter value
191     * @return a result value
192     */
193    R visitReference(ReferenceTree node, P p);
194
195    /**
196     * Visits a ReturnTree node.
197     * @param node the node being visited
198     * @param p a parameter value
199     * @return a result value
200     */
201    R visitReturn(ReturnTree node, P p);
202
203    /**
204     * Visits a SeeTree node.
205     * @param node the node being visited
206     * @param p a parameter value
207     * @return a result value
208     */
209    R visitSee(SeeTree node, P p);
210
211    /**
212     * Visits a SerialTree node.
213     * @param node the node being visited
214     * @param p a parameter value
215     * @return a result value
216     */
217    R visitSerial(SerialTree node, P p);
218
219    /**
220     * Visits a SerialDataTree node.
221     * @param node the node being visited
222     * @param p a parameter value
223     * @return a result value
224     */
225    R visitSerialData(SerialDataTree node, P p);
226
227    /**
228     * Visits a SerialFieldTree node.
229     * @param node the node being visited
230     * @param p a parameter value
231     * @return a result value
232     */
233    R visitSerialField(SerialFieldTree node, P p);
234
235    /**
236     * Visits a SinceTree node.
237     * @param node the node being visited
238     * @param p a parameter value
239     * @return a result value
240     */
241    R visitSince(SinceTree node, P p);
242
243    /**
244     * Visits a StartElementTree node.
245     * @param node the node being visited
246     * @param p a parameter value
247     * @return a result value
248     */
249    R visitStartElement(StartElementTree node, P p);
250
251    /**
252     * Visits a TextTree node.
253     * @param node the node being visited
254     * @param p a parameter value
255     * @return a result value
256     */
257    R visitText(TextTree node, P p);
258
259    /**
260     * Visits a ThrowsTree node.
261     * @param node the node being visited
262     * @param p a parameter value
263     * @return a result value
264     */
265    R visitThrows(ThrowsTree node, P p);
266
267    /**
268     * Visits an UnknownBlockTagTree node.
269     * @param node the node being visited
270     * @param p a parameter value
271     * @return a result value
272     */
273    R visitUnknownBlockTag(UnknownBlockTagTree node, P p);
274
275    /**
276     * Visits an UnknownInlineTagTree node.
277     * @param node the node being visited
278     * @param p a parameter value
279     * @return a result value
280     */
281    R visitUnknownInlineTag(UnknownInlineTagTree node, P p);
282
283    /**
284     * Visits a ValueTree node.
285     * @param node the node being visited
286     * @param p a parameter value
287     * @return a result value
288     */
289    R visitValue(ValueTree node, P p);
290
291    /**
292     * Visits a VersionTreeTree node.
293     * @param node the node being visited
294     * @param p a parameter value
295     * @return a result value
296     */
297    R visitVersion(VersionTree node, P p);
298
299    /**
300     * Visits an unknown type of DocTree node.
301     * This can occur if the set of tags evolves and new kinds
302     * of nodes are added to the {@code DocTree} hierarchy.
303     * @param node the node being visited
304     * @param p a parameter value
305     * @return a result value
306     */
307    R visitOther(DocTree node, P p);
308}
309