View Javadoc

1   package serp.bytecode.visitor;
2   
3   import serp.bytecode.*;
4   import serp.bytecode.Deprecated;
5   import serp.bytecode.lowlevel.*;
6   
7   
8   /***
9    * Base class for visitors on a bytecode entity. The public {@link #visit}
10   * method will traverse the object graph of the given entity, calling the
11   * <code>enter*</code> and <code>exit*</code> methods as it visits each
12   * object. The traversal is done depth-first. Subclasses should override
13   * only the methods for visiting the entities they are interested in.
14   * Whenever there is a general method (i.e. <code>enter/exitEntry</code>) as
15   * well as a more specific one (i.e. <code>enter/exitStringEntry</code>), the
16   * more general method will be called first, followed by a call on the correct
17   * specific method. Most subclasses will override either the general or
18   * specific cases, but not both.
19   *
20   * @author Abe White
21   */
22  public class BCVisitor {
23      /***
24       * Visit the given entity.
25       */
26      public void visit(VisitAcceptor obj) {
27          if (obj == null)
28              return;
29          obj.acceptVisit(this);
30      }
31  
32      public void enterProject(Project obj) {
33      }
34  
35      public void exitProject(Project obj) {
36      }
37  
38      public void enterBCClass(BCClass obj) {
39      }
40  
41      public void exitBCClass(BCClass obj) {
42      }
43  
44      public void enterBCMember(BCMember obj) {
45      }
46  
47      public void exitBCMember(BCMember obj) {
48      }
49  
50      public void enterBCField(BCField obj) {
51      }
52  
53      public void exitBCField(BCField obj) {
54      }
55  
56      public void enterBCMethod(BCMethod obj) {
57      }
58  
59      public void exitBCMethod(BCMethod obj) {
60      }
61  
62      public void enterAttribute(Attribute obj) {
63      }
64  
65      public void exitAttribute(Attribute obj) {
66      }
67  
68      public void enterConstantValue(ConstantValue obj) {
69      }
70  
71      public void exitConstantValue(ConstantValue obj) {
72      }
73  
74      public void enterDeprecated(Deprecated obj) {
75      }
76  
77      public void exitDeprecated(Deprecated obj) {
78      }
79  
80      public void enterExceptions(Exceptions obj) {
81      }
82  
83      public void exitExceptions(Exceptions obj) {
84      }
85  
86      public void enterInnerClasses(InnerClasses obj) {
87      }
88  
89      public void exitInnerClasses(InnerClasses obj) {
90      }
91  
92      public void enterLineNumberTable(LineNumberTable obj) {
93      }
94  
95      public void exitLineNumberTable(LineNumberTable obj) {
96      }
97  
98      public void enterLocalVariableTable(LocalVariableTable obj) {
99      }
100 
101     public void exitLocalVariableTable(LocalVariableTable obj) {
102     }
103 
104     public void enterLocalVariableTypeTable(LocalVariableTypeTable obj) {
105     }
106 
107     public void exitLocalVariableTypeTable(LocalVariableTypeTable obj) {
108     }
109 
110     public void enterAnnotations(Annotations obj) {
111     }
112 
113     public void exitAnnotations(Annotations obj) {
114     }
115 
116     public void enterAnnotation(Annotation obj) {
117     }
118 
119     public void exitAnnotation(Annotation obj) {
120     }
121 
122     public void enterAnnotationProperty(Annotation.Property obj) {
123     }
124 
125     public void exitAnnotationProperty(Annotation.Property obj) {
126     }
127 
128     public void enterSourceFile(SourceFile obj) {
129     }
130 
131     public void exitSourceFile(SourceFile obj) {
132     }
133 
134     public void enterSynthetic(Synthetic obj) {
135     }
136 
137     public void exitSynthetic(Synthetic obj) {
138     }
139 
140     public void enterUnknownAttribute(UnknownAttribute obj) {
141     }
142 
143     public void exitUnknownAttribute(UnknownAttribute obj) {
144     }
145 
146     public void enterCode(Code obj) {
147     }
148 
149     public void exitCode(Code obj) {
150     }
151 
152     public void enterExceptionHandler(ExceptionHandler obj) {
153     }
154 
155     public void exitExceptionHandler(ExceptionHandler obj) {
156     }
157 
158     public void enterInnerClass(InnerClass obj) {
159     }
160 
161     public void exitInnerClass(InnerClass obj) {
162     }
163 
164     public void enterLineNumber(LineNumber obj) {
165     }
166 
167     public void exitLineNumber(LineNumber obj) {
168     }
169 
170     public void enterLocalVariable(LocalVariable obj) {
171     }
172 
173     public void exitLocalVariable(LocalVariable obj) {
174     }
175 
176     public void enterLocalVariableType(LocalVariableType obj) {
177     }
178 
179     public void exitLocalVariableType(LocalVariableType obj) {
180     }
181 
182     public void enterInstruction(Instruction obj) {
183     }
184 
185     public void exitInstruction(Instruction obj) {
186     }
187 
188     public void enterArrayLoadInstruction(ArrayLoadInstruction obj) {
189     }
190 
191     public void exitArrayLoadInstruction(ArrayLoadInstruction obj) {
192     }
193 
194     public void enterArrayStoreInstruction(ArrayStoreInstruction obj) {
195     }
196 
197     public void exitArrayStoreInstruction(ArrayStoreInstruction obj) {
198     }
199 
200     public void enterClassInstruction(ClassInstruction obj) {
201     }
202 
203     public void exitClassInstruction(ClassInstruction obj) {
204     }
205 
206     public void enterConstantInstruction(ConstantInstruction obj) {
207     }
208 
209     public void exitConstantInstruction(ConstantInstruction obj) {
210     }
211 
212     public void enterConvertInstruction(ConvertInstruction obj) {
213     }
214 
215     public void exitConvertInstruction(ConvertInstruction obj) {
216     }
217 
218     public void enterGetFieldInstruction(GetFieldInstruction obj) {
219     }
220 
221     public void exitGetFieldInstruction(GetFieldInstruction obj) {
222     }
223 
224     public void enterIIncInstruction(IIncInstruction obj) {
225     }
226 
227     public void exitIIncInstruction(IIncInstruction obj) {
228     }
229 
230     public void enterJumpInstruction(JumpInstruction obj) {
231     }
232 
233     public void exitJumpInstruction(JumpInstruction obj) {
234     }
235 
236     public void enterIfInstruction(IfInstruction obj) {
237     }
238 
239     public void exitIfInstruction(IfInstruction obj) {
240     }
241 
242     public void enterLoadInstruction(LoadInstruction obj) {
243     }
244 
245     public void exitLoadInstruction(LoadInstruction obj) {
246     }
247 
248     public void enterLookupSwitchInstruction(LookupSwitchInstruction obj) {
249     }
250 
251     public void exitLookupSwitchInstruction(LookupSwitchInstruction obj) {
252     }
253 
254     public void enterMathInstruction(MathInstruction obj) {
255     }
256 
257     public void exitMathInstruction(MathInstruction obj) {
258     }
259 
260     public void enterMethodInstruction(MethodInstruction obj) {
261     }
262 
263     public void exitMethodInstruction(MethodInstruction obj) {
264     }
265 
266     public void enterMultiANewArrayInstruction(MultiANewArrayInstruction obj) {
267     }
268 
269     public void exitMultiANewArrayInstruction(MultiANewArrayInstruction obj) {
270     }
271 
272     public void enterNewArrayInstruction(NewArrayInstruction obj) {
273     }
274 
275     public void exitNewArrayInstruction(NewArrayInstruction obj) {
276     }
277 
278     public void enterPutFieldInstruction(PutFieldInstruction obj) {
279     }
280 
281     public void exitPutFieldInstruction(PutFieldInstruction obj) {
282     }
283 
284     public void enterRetInstruction(RetInstruction obj) {
285     }
286 
287     public void exitRetInstruction(RetInstruction obj) {
288     }
289 
290     public void enterReturnInstruction(ReturnInstruction obj) {
291     }
292 
293     public void exitReturnInstruction(ReturnInstruction obj) {
294     }
295 
296     public void enterStackInstruction(StackInstruction obj) {
297     }
298 
299     public void exitStackInstruction(StackInstruction obj) {
300     }
301 
302     public void enterStoreInstruction(StoreInstruction obj) {
303     }
304 
305     public void exitStoreInstruction(StoreInstruction obj) {
306     }
307 
308     public void enterTableSwitchInstruction(TableSwitchInstruction obj) {
309     }
310 
311     public void exitTableSwitchInstruction(TableSwitchInstruction obj) {
312     }
313 
314     public void enterWideInstruction(WideInstruction obj) {
315     }
316 
317     public void exitWideInstruction(WideInstruction obj) {
318     }
319 
320     public void enterMonitorEnterInstruction(MonitorEnterInstruction obj) {
321     }
322 
323     public void exitMonitorEnterInstruction(MonitorEnterInstruction obj) {
324     }
325 
326     public void enterMonitorExitInstruction(MonitorExitInstruction obj) {
327     }
328 
329     public void exitMonitorExitInstruction(MonitorExitInstruction obj) {
330     }
331 
332     public void enterCmpInstruction(CmpInstruction obj) {
333     }
334 
335     public void exitCmpInstruction(CmpInstruction obj) {
336     }
337 
338     public void enterConstantPool(ConstantPool obj) {
339     }
340 
341     public void exitConstantPool(ConstantPool obj) {
342     }
343 
344     public void enterEntry(Entry obj) {
345     }
346 
347     public void exitEntry(Entry obj) {
348     }
349 
350     public void enterClassEntry(ClassEntry obj) {
351     }
352 
353     public void exitClassEntry(ClassEntry obj) {
354     }
355 
356     public void enterDoubleEntry(DoubleEntry obj) {
357     }
358 
359     public void exitDoubleEntry(DoubleEntry obj) {
360     }
361 
362     public void enterFieldEntry(FieldEntry obj) {
363     }
364 
365     public void exitFieldEntry(FieldEntry obj) {
366     }
367 
368     public void enterFloatEntry(FloatEntry obj) {
369     }
370 
371     public void exitFloatEntry(FloatEntry obj) {
372     }
373 
374     public void enterIntEntry(IntEntry obj) {
375     }
376 
377     public void exitIntEntry(IntEntry obj) {
378     }
379 
380     public void enterInterfaceMethodEntry(InterfaceMethodEntry obj) {
381     }
382 
383     public void exitInterfaceMethodEntry(InterfaceMethodEntry obj) {
384     }
385 
386     public void enterLongEntry(LongEntry obj) {
387     }
388 
389     public void exitLongEntry(LongEntry obj) {
390     }
391 
392     public void enterMethodEntry(MethodEntry obj) {
393     }
394 
395     public void exitMethodEntry(MethodEntry obj) {
396     }
397 
398     public void enterNameAndTypeEntry(NameAndTypeEntry obj) {
399     }
400 
401     public void exitNameAndTypeEntry(NameAndTypeEntry obj) {
402     }
403 
404     public void enterStringEntry(StringEntry obj) {
405     }
406 
407     public void exitStringEntry(StringEntry obj) {
408     }
409 
410     public void enterUTF8Entry(UTF8Entry obj) {
411     }
412 
413     public void exitUTF8Entry(UTF8Entry obj) {
414     }
415 }