001: /*
002: * Spoon - http://spoon.gforge.inria.fr/
003: * Copyright (C) 2006 INRIA Futurs <renaud.pawlak@inria.fr>
004: *
005: * This software is governed by the CeCILL-C License under French law and
006: * abiding by the rules of distribution of free software. You can use, modify
007: * and/or redistribute the software under the terms of the CeCILL-C license as
008: * circulated by CEA, CNRS and INRIA at http://www.cecill.info.
009: *
010: * This program is distributed in the hope that it will be useful, but WITHOUT
011: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012: * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
013: *
014: * The fact that you are presently reading this means that you have had
015: * knowledge of the CeCILL-C license and that you accept its terms.
016: */
017:
018: package spoon.reflect.visitor;
019:
020: import java.lang.annotation.Annotation;
021:
022: import spoon.reflect.code.CtArrayAccess;
023: import spoon.reflect.code.CtAssert;
024: import spoon.reflect.code.CtAssignment;
025: import spoon.reflect.code.CtBinaryOperator;
026: import spoon.reflect.code.CtBlock;
027: import spoon.reflect.code.CtBreak;
028: import spoon.reflect.code.CtCase;
029: import spoon.reflect.code.CtCatch;
030: import spoon.reflect.code.CtCodeSnippetExpression;
031: import spoon.reflect.code.CtCodeSnippetStatement;
032: import spoon.reflect.code.CtConditional;
033: import spoon.reflect.code.CtContinue;
034: import spoon.reflect.code.CtDo;
035: import spoon.reflect.code.CtExpression;
036: import spoon.reflect.code.CtFieldAccess;
037: import spoon.reflect.code.CtFor;
038: import spoon.reflect.code.CtForEach;
039: import spoon.reflect.code.CtIf;
040: import spoon.reflect.code.CtInvocation;
041: import spoon.reflect.code.CtLiteral;
042: import spoon.reflect.code.CtLocalVariable;
043: import spoon.reflect.code.CtNewArray;
044: import spoon.reflect.code.CtNewClass;
045: import spoon.reflect.code.CtOperatorAssignment;
046: import spoon.reflect.code.CtReturn;
047: import spoon.reflect.code.CtStatementList;
048: import spoon.reflect.code.CtSwitch;
049: import spoon.reflect.code.CtSynchronized;
050: import spoon.reflect.code.CtThrow;
051: import spoon.reflect.code.CtTry;
052: import spoon.reflect.code.CtUnaryOperator;
053: import spoon.reflect.code.CtVariableAccess;
054: import spoon.reflect.code.CtWhile;
055: import spoon.reflect.declaration.CtAnnotation;
056: import spoon.reflect.declaration.CtAnnotationType;
057: import spoon.reflect.declaration.CtAnonymousExecutable;
058: import spoon.reflect.declaration.CtClass;
059: import spoon.reflect.declaration.CtConstructor;
060: import spoon.reflect.declaration.CtEnum;
061: import spoon.reflect.declaration.CtField;
062: import spoon.reflect.declaration.CtInterface;
063: import spoon.reflect.declaration.CtMethod;
064: import spoon.reflect.declaration.CtPackage;
065: import spoon.reflect.declaration.CtParameter;
066: import spoon.reflect.declaration.CtTypeParameter;
067: import spoon.reflect.reference.CtArrayTypeReference;
068: import spoon.reflect.reference.CtExecutableReference;
069: import spoon.reflect.reference.CtFieldReference;
070: import spoon.reflect.reference.CtLocalVariableReference;
071: import spoon.reflect.reference.CtPackageReference;
072: import spoon.reflect.reference.CtParameterReference;
073: import spoon.reflect.reference.CtTypeParameterReference;
074: import spoon.reflect.reference.CtTypeReference;
075:
076: /**
077: * This interface defines the visitor for the Spoon metamodel, as defined in
078: * {@link spoon.reflect.declaration}, {@link spoon.reflect.code}, and
079: * {@link spoon.reflect.reference}.
080: */
081: public interface CtVisitor {
082: /**
083: * Visits an annotation.
084: */
085: <A extends Annotation> void visitCtAnnotation(
086: CtAnnotation<A> annotation);
087:
088: /**
089: * Visits a code snippet expression.
090: */
091: <T> void visitCtCodeSnippetExpression(
092: CtCodeSnippetExpression<T> expression);
093:
094: /**
095: * Visits a code snippet statement.
096: */
097: void visitCtCodeSnippetStatement(CtCodeSnippetStatement statement);
098:
099: /**
100: * Visits an annotation type declaration.
101: */
102: <A extends Annotation> void visitCtAnnotationType(
103: CtAnnotationType<A> annotationType);
104:
105: /**
106: * Visits an anonymous executable.
107: */
108: void visitCtAnonymousExecutable(CtAnonymousExecutable anonymousExec);
109:
110: /**
111: * Visits an array access.
112: */
113: <T, E extends CtExpression<?>> void visitCtArrayAccess(
114: CtArrayAccess<T, E> arrayAccess);
115:
116: /**
117: * Visits a reference to an array type.
118: */
119: <T> void visitCtArrayTypeReference(CtArrayTypeReference<T> reference);
120:
121: /**
122: * Visits an assert.
123: */
124: <T> void visitCtAssert(CtAssert<T> asserted);
125:
126: /**
127: * Visits an assignment.
128: */
129: <T, A extends T> void visitCtAssignment(
130: CtAssignment<T, A> assignement);
131:
132: /**
133: * Visits a binary operator.
134: */
135: <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator);
136:
137: /**
138: * Visits a block of code.
139: */
140: <R> void visitCtBlock(CtBlock<R> block);
141:
142: /**
143: * Visits a <code>break</code> statement.
144: */
145: void visitCtBreak(CtBreak breakStatement);
146:
147: /**
148: * Visits a <code>case</code> clause.
149: */
150: <S> void visitCtCase(CtCase<S> caseStatement);
151:
152: /**
153: * Visits a <code>catch</code> clause.
154: */
155: void visitCtCatch(CtCatch catchBlock);
156:
157: /**
158: * Visits a class declaration.
159: */
160: <T> void visitCtClass(CtClass<T> ctClass);
161:
162: /**
163: * Visits a conditional expression
164: */
165: <T> void visitCtConditional(CtConditional<T> conditional);
166:
167: /**
168: * Visits a constructor declaration.
169: */
170: <T> void visitCtConstructor(CtConstructor<T> c);
171:
172: /**
173: * Visits a <code>continue</code> statement.
174: */
175: void visitCtContinue(CtContinue continueStatement);
176:
177: /**
178: * Visits a <code>do</code> loop.
179: */
180: void visitCtDo(CtDo doLoop);
181:
182: /**
183: * Visits an enumeration declaration.
184: */
185: <T extends Enum<?>> void visitCtEnum(CtEnum<T> ctEnum);
186:
187: /**
188: * Visits a reference to an executable.
189: */
190: <T> void visitCtExecutableReference(
191: CtExecutableReference<T> reference);
192:
193: /**
194: * Visits a field declaration.
195: */
196: <T> void visitCtField(CtField<T> f);
197:
198: /**
199: * Visits a field access.
200: */
201: <T> void visitCtFieldAccess(CtFieldAccess<T> fieldAccess);
202:
203: /**
204: * Visits a reference to a field.
205: */
206: <T> void visitCtFieldReference(CtFieldReference<T> reference);
207:
208: /**
209: * Visits a <code>for</code> loop.
210: */
211: void visitCtFor(CtFor forLoop);
212:
213: /**
214: * Visits an enhanced <code>for</code> loop.
215: */
216: void visitCtForEach(CtForEach foreach);
217:
218: /**
219: * Visits an <code>if</code> statement.
220: */
221: void visitCtIf(CtIf ifElement);
222:
223: /**
224: * Visits an interface declaration.
225: */
226: <T> void visitCtInterface(CtInterface<T> intrface);
227:
228: /**
229: * Visits an executable invocation.
230: */
231: <T> void visitCtInvocation(CtInvocation<T> invocation);
232:
233: /**
234: * Visits a literal expression.
235: */
236: <T> void visitCtLiteral(CtLiteral<T> literal);
237:
238: /**
239: * Visits a local variable declaration.
240: */
241: <T> void visitCtLocalVariable(CtLocalVariable<T> localVariable);
242:
243: /**
244: * Visits a reference to a local variable.
245: */
246: <T> void visitCtLocalVariableReference(
247: CtLocalVariableReference<T> reference);
248:
249: /**
250: * Visits a method declaration.
251: */
252: <T> void visitCtMethod(CtMethod<T> m);
253:
254: /**
255: * Visits an array construction.
256: */
257: <T> void visitCtNewArray(CtNewArray<T> newArray);
258:
259: /**
260: * Visits an anonymous class construction.
261: */
262: <T> void visitCtNewClass(CtNewClass<T> newClass);
263:
264: /**
265: * Visits an operator assignment.
266: */
267: <T, A extends T> void visitCtOperatorAssignement(
268: CtOperatorAssignment<T, A> assignment);
269:
270: /**
271: * Visits a package declaration.
272: */
273: void visitCtPackage(CtPackage ctPackage);
274:
275: /**
276: * Visits a reference to a package.
277: */
278: void visitCtPackageReference(CtPackageReference reference);
279:
280: /**
281: * Visits a parameter declaration.
282: */
283: <T> void visitCtParameter(CtParameter<T> parameter);
284:
285: /**
286: * Visits a reference to a parameter.
287: */
288: <T> void visitCtParameterReference(CtParameterReference<T> reference);
289:
290: /**
291: * Visits a <code>return</code> statement.
292: */
293: <R> void visitCtReturn(CtReturn<R> returnStatement);
294:
295: /**
296: * Visits a statement list.
297: */
298: <R> void visitCtStatementList(CtStatementList<R> statements);
299:
300: /**
301: * Visits a <code>switch</code> statement.
302: */
303: <S> void visitCtSwitch(CtSwitch<S> switchStatement);
304:
305: /**
306: * Visits a <code>synchronized</code> modifier.
307: */
308: void visitCtSynchronized(CtSynchronized synchro);
309:
310: /**
311: * Visits a <code>throw</code> statement.
312: */
313: void visitCtThrow(CtThrow throwStatement);
314:
315: /**
316: * Visits a <code>try</code> statement.
317: */
318: void visitCtTry(CtTry tryBlock);
319:
320: /**
321: * Visits a type parameter declaration.
322: */
323: void visitCtTypeParameter(CtTypeParameter typeParameter);
324:
325: /**
326: * Visits a reference to a type parameter.
327: */
328: void visitCtTypeParameterReference(CtTypeParameterReference ref);
329:
330: /**
331: * Visits a reference to a type.
332: */
333: <T> void visitCtTypeReference(CtTypeReference<T> reference);
334:
335: /**
336: * Visits a unary operator.
337: */
338: <T> void visitCtUnaryOperator(CtUnaryOperator<T> operator);
339:
340: /**
341: * Visits a variable access.
342: */
343: <T> void visitCtVariableAccess(CtVariableAccess<T> variableAccess);
344:
345: /**
346: * Visits a <code>while</code> loop.
347: */
348: void visitCtWhile(CtWhile whileLoop);
349:
350: }
|