src/share/classes/com/sun/source/tree/TreeVisitor.java

changeset 1
9a66ca7c79fa
child 308
03944ee4fac4
equal deleted inserted replaced
-1:000000000000 1:9a66ca7c79fa
1 /*
2 * Copyright 2005-2006 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package com.sun.source.tree;
27
28 /**
29 * A visitor of trees, in the style of the visitor design pattern.
30 * Classes implementing this interface are used to operate
31 * on a tree when the kind of tree is unknown at compile time.
32 * When a visitor is passed to an tree's {@link Tree#accept
33 * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
34 * to that tree is invoked.
35 *
36 * <p> Classes implementing this interface may or may not throw a
37 * {@code NullPointerException} if the additional parameter {@code p}
38 * is {@code null}; see documentation of the implementing class for
39 * details.
40 *
41 * <p> <b>WARNING:</b> It is possible that methods will be added to
42 * this interface to accommodate new, currently unknown, language
43 * structures added to future versions of the Java&trade; programming
44 * language. Therefore, visitor classes directly implementing this
45 * interface may be source incompatible with future versions of the
46 * platform.
47 *
48 * @param <R> the return type of this visitor's methods. Use {@link
49 * Void} for visitors that do not need to return results.
50 * @param <P> the type of the additional parameter to this visitor's
51 * methods. Use {@code Void} for visitors that do not need an
52 * additional parameter.
53 *
54 * @author Peter von der Ah&eacute;
55 * @author Jonathan Gibbons
56 *
57 * @since 1.6
58 */
59 public interface TreeVisitor<R,P> {
60 R visitAnnotation(AnnotationTree node, P p);
61 R visitMethodInvocation(MethodInvocationTree node, P p);
62 R visitAssert(AssertTree node, P p);
63 R visitAssignment(AssignmentTree node, P p);
64 R visitCompoundAssignment(CompoundAssignmentTree node, P p);
65 R visitBinary(BinaryTree node, P p);
66 R visitBlock(BlockTree node, P p);
67 R visitBreak(BreakTree node, P p);
68 R visitCase(CaseTree node, P p);
69 R visitCatch(CatchTree node, P p);
70 R visitClass(ClassTree node, P p);
71 R visitConditionalExpression(ConditionalExpressionTree node, P p);
72 R visitContinue(ContinueTree node, P p);
73 R visitDoWhileLoop(DoWhileLoopTree node, P p);
74 R visitErroneous(ErroneousTree node, P p);
75 R visitExpressionStatement(ExpressionStatementTree node, P p);
76 R visitEnhancedForLoop(EnhancedForLoopTree node, P p);
77 R visitForLoop(ForLoopTree node, P p);
78 R visitIdentifier(IdentifierTree node, P p);
79 R visitIf(IfTree node, P p);
80 R visitImport(ImportTree node, P p);
81 R visitArrayAccess(ArrayAccessTree node, P p);
82 R visitLabeledStatement(LabeledStatementTree node, P p);
83 R visitLiteral(LiteralTree node, P p);
84 R visitMethod(MethodTree node, P p);
85 R visitModifiers(ModifiersTree node, P p);
86 R visitNewArray(NewArrayTree node, P p);
87 R visitNewClass(NewClassTree node, P p);
88 R visitParenthesized(ParenthesizedTree node, P p);
89 R visitReturn(ReturnTree node, P p);
90 R visitMemberSelect(MemberSelectTree node, P p);
91 R visitEmptyStatement(EmptyStatementTree node, P p);
92 R visitSwitch(SwitchTree node, P p);
93 R visitSynchronized(SynchronizedTree node, P p);
94 R visitThrow(ThrowTree node, P p);
95 R visitCompilationUnit(CompilationUnitTree node, P p);
96 R visitTry(TryTree node, P p);
97 R visitParameterizedType(ParameterizedTypeTree node, P p);
98 R visitArrayType(ArrayTypeTree node, P p);
99 R visitTypeCast(TypeCastTree node, P p);
100 R visitPrimitiveType(PrimitiveTypeTree node, P p);
101 R visitTypeParameter(TypeParameterTree node, P p);
102 R visitInstanceOf(InstanceOfTree node, P p);
103 R visitUnary(UnaryTree node, P p);
104 R visitVariable(VariableTree node, P p);
105 R visitWhileLoop(WhileLoopTree node, P p);
106 R visitWildcard(WildcardTree node, P p);
107 R visitOther(Tree node, P p);
108 }

mercurial