KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > mirror > util > SimpleDeclarationVisitor


1 /*
2  * @(#)SimpleDeclarationVisitor.java 1.3 04/04/30
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.mirror.util;
9
10
11 import com.sun.mirror.declaration.*;
12
13
14 /**
15  * A simple visitor for declarations.
16  *
17  * <p> The implementations of the methods of this class do nothing but
18  * delegate up the declaration hierarchy. A subclass should override the
19  * methods that correspond to the kinds of declarations on which it
20  * will operate.
21  *
22  * @author Joseph D. Darcy
23  * @author Scott Seligman
24  * @version 1.3 04/04/30
25  * @since 1.5
26  */

27
28 public class SimpleDeclarationVisitor implements DeclarationVisitor {
29
30     /**
31      * Creates a new <tt>SimpleDeclarationVisitor</tt>.
32      */

33     public SimpleDeclarationVisitor(){}
34
35     /**
36      * Visits a declaration.
37      * The implementation does nothing.
38      * @param d the declaration to visit
39      */

40     public void visitDeclaration(Declaration d) {
41     }
42
43     /**
44      * Visits a package declaration.
45      * The implementation simply invokes
46      * {@link #visitDeclaration visitDeclaration}.
47      * @param d the declaration to visit
48      */

49     public void visitPackageDeclaration(PackageDeclaration d) {
50     visitDeclaration(d);
51     }
52
53     /**
54      * Visits a member or constructor declaration.
55      * The implementation simply invokes
56      * {@link #visitDeclaration visitDeclaration}.
57      * @param d the declaration to visit
58      */

59     public void visitMemberDeclaration(MemberDeclaration d) {
60     visitDeclaration(d);
61     }
62
63     /**
64      * Visits a type declaration.
65      * The implementation simply invokes
66      * {@link #visitMemberDeclaration visitMemberDeclaration}.
67      * @param d the declaration to visit
68      */

69     public void visitTypeDeclaration(TypeDeclaration d) {
70     visitMemberDeclaration(d);
71     }
72
73     /**
74      * Visits a class declaration.
75      * The implementation simply invokes
76      * {@link #visitTypeDeclaration visitTypeDeclaration}.
77      * @param d the declaration to visit
78      */

79     public void visitClassDeclaration(ClassDeclaration d) {
80     visitTypeDeclaration(d);
81     }
82
83     /**
84      * Visits an enum declaration.
85      * The implementation simply invokes
86      * {@link #visitClassDeclaration visitClassDeclaration}.
87      * @param d the declaration to visit
88      */

89     public void visitEnumDeclaration(EnumDeclaration d) {
90     visitClassDeclaration(d);
91     }
92
93     /**
94      * Visits an interface declaration.
95      * The implementation simply invokes
96      * {@link #visitTypeDeclaration visitTypeDeclaration}.
97      * @param d the declaration to visit
98      */

99     public void visitInterfaceDeclaration(InterfaceDeclaration d) {
100     visitTypeDeclaration(d);
101     }
102
103     /**
104      * Visits an annotation type declaration.
105      * The implementation simply invokes
106      * {@link #visitInterfaceDeclaration visitInterfaceDeclaration}.
107      * @param d the declaration to visit
108      */

109     public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {
110     visitInterfaceDeclaration(d);
111     }
112
113     /**
114      * Visits a field declaration.
115      * The implementation simply invokes
116      * {@link #visitMemberDeclaration visitMemberDeclaration}.
117      * @param d the declaration to visit
118      */

119     public void visitFieldDeclaration(FieldDeclaration d) {
120     visitMemberDeclaration(d);
121     }
122
123     /**
124      * Visits an enum constant declaration.
125      * The implementation simply invokes
126      * {@link #visitFieldDeclaration visitFieldDeclaration}.
127      * @param d the declaration to visit
128      */

129     public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {
130     visitFieldDeclaration(d);
131     }
132
133     /**
134      * Visits a method or constructor declaration.
135      * The implementation simply invokes
136      * {@link #visitMemberDeclaration visitMemberDeclaration}.
137      * @param d the declaration to visit
138      */

139     public void visitExecutableDeclaration(ExecutableDeclaration d) {
140     visitMemberDeclaration(d);
141     }
142
143     /**
144      * Visits a constructor declaration.
145      * The implementation simply invokes
146      * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
147      * @param d the declaration to visit
148      */

149     public void visitConstructorDeclaration(ConstructorDeclaration d) {
150     visitExecutableDeclaration(d);
151     }
152
153     /**
154      * Visits a method declaration.
155      * The implementation simply invokes
156      * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
157      * @param d the declaration to visit
158      */

159     public void visitMethodDeclaration(MethodDeclaration d) {
160     visitExecutableDeclaration(d);
161     }
162
163     /**
164      * Visits an annotation type element declaration.
165      * The implementation simply invokes
166      * {@link #visitMethodDeclaration visitMethodDeclaration}.
167      * @param d the declaration to visit
168      */

169     public void visitAnnotationTypeElementDeclaration(
170         AnnotationTypeElementDeclaration d) {
171     visitMethodDeclaration(d);
172     }
173
174     /**
175      * Visits a parameter declaration.
176      * The implementation simply invokes
177      * {@link #visitDeclaration visitDeclaration}.
178      * @param d the declaration to visit
179      */

180     public void visitParameterDeclaration(ParameterDeclaration d) {
181     visitDeclaration(d);
182     }
183
184     /**
185      * Visits a type parameter declaration.
186      * The implementation simply invokes
187      * {@link #visitDeclaration visitDeclaration}.
188      * @param d the declaration to visit
189      */

190     public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {
191     visitDeclaration(d);
192     }
193 }
194
Popular Tags