View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  package org.apache.bcel.classfile;
18  
19  /**
20   * Interface to make use of the Visitor pattern programming style. I.e. a class that implements this interface can
21   * traverse the contents of a Java class just by calling the 'accept' method which all classes have.
22   */
23  public interface Visitor {
24      /**
25       * @since 6.0
26       */
27      void visitAnnotation(Annotations obj);
28  
29      /**
30       * @since 6.0
31       */
32      void visitAnnotationDefault(AnnotationDefault obj);
33  
34      /**
35       * @since 6.0
36       */
37      void visitAnnotationEntry(AnnotationEntry obj);
38  
39      /**
40       * @since 6.0
41       */
42      void visitBootstrapMethods(BootstrapMethods obj);
43  
44      void visitCode(Code obj);
45  
46      void visitCodeException(CodeException obj);
47  
48      void visitConstantClass(ConstantClass obj);
49  
50      void visitConstantDouble(ConstantDouble obj);
51  
52      /**
53       * @since 6.3
54       */
55      default void visitConstantDynamic(final ConstantDynamic constantDynamic) {
56          // empty
57      }
58  
59      void visitConstantFieldref(ConstantFieldref obj);
60  
61      void visitConstantFloat(ConstantFloat obj);
62  
63      void visitConstantInteger(ConstantInteger obj);
64  
65      void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj);
66  
67      void visitConstantInvokeDynamic(ConstantInvokeDynamic obj);
68  
69      void visitConstantLong(ConstantLong obj);
70  
71      /**
72       * @since 6.0
73       */
74      void visitConstantMethodHandle(ConstantMethodHandle obj);
75  
76      void visitConstantMethodref(ConstantMethodref obj);
77  
78      /**
79       * @since 6.0
80       */
81      void visitConstantMethodType(ConstantMethodType obj);
82  
83      /**
84       * @since 6.1
85       */
86      void visitConstantModule(ConstantModule constantModule);
87  
88      void visitConstantNameAndType(ConstantNameAndType obj);
89  
90      /**
91       * @since 6.1
92       */
93      void visitConstantPackage(ConstantPackage constantPackage);
94  
95      void visitConstantPool(ConstantPool obj);
96  
97      void visitConstantString(ConstantString obj);
98  
99      void visitConstantUtf8(ConstantUtf8 obj);
100 
101     void visitConstantValue(ConstantValue obj);
102 
103     void visitDeprecated(Deprecated obj);
104 
105     /**
106      * @since 6.0
107      */
108     void visitEnclosingMethod(EnclosingMethod obj);
109 
110     void visitExceptionTable(ExceptionTable obj);
111 
112     void visitField(Field obj);
113 
114     void visitInnerClass(InnerClass obj);
115 
116     void visitInnerClasses(InnerClasses obj);
117 
118     void visitJavaClass(JavaClass obj);
119 
120     void visitLineNumber(LineNumber obj);
121 
122     void visitLineNumberTable(LineNumberTable obj);
123 
124     void visitLocalVariable(LocalVariable obj);
125 
126     void visitLocalVariableTable(LocalVariableTable obj);
127 
128     /**
129      * @since 6.0
130      */
131     void visitLocalVariableTypeTable(LocalVariableTypeTable obj);
132 
133     void visitMethod(Method obj);
134 
135     /**
136      * @since 6.4.0
137      */
138     default void visitMethodParameter(final MethodParameter obj) {
139         // empty
140     }
141 
142     /**
143      * @since 6.0
144      */
145     void visitMethodParameters(MethodParameters obj);
146 
147     /**
148      * @since 6.4.0
149      */
150     default void visitModule(final Module constantModule) {
151         // empty
152     }
153 
154     /**
155      * @since 6.4.0
156      */
157     default void visitModuleExports(final ModuleExports constantModule) {
158         // empty
159     }
160 
161     /**
162      * @since 6.4.0
163      */
164     default void visitModuleMainClass(final ModuleMainClass obj) {
165         // empty
166     }
167 
168     /**
169      * @since 6.4.0
170      */
171     default void visitModuleOpens(final ModuleOpens constantModule) {
172         // empty
173     }
174 
175     /**
176      * @since 6.4.0
177      */
178     default void visitModulePackages(final ModulePackages constantModule) {
179         // empty
180     }
181 
182     /**
183      * @since 6.4.0
184      */
185     default void visitModuleProvides(final ModuleProvides constantModule) {
186         // empty
187     }
188 
189     /**
190      * @since 6.4.0
191      */
192     default void visitModuleRequires(final ModuleRequires constantModule) {
193         // empty
194     }
195 
196     /**
197      * @since 6.4.0
198      */
199     default void visitNestHost(final NestHost obj) {
200         // empty
201     }
202 
203     /**
204      * @since 6.4.0
205      */
206     default void visitNestMembers(final NestMembers obj) {
207         // empty
208     }
209 
210     /**
211      * @since 6.0
212      */
213     void visitParameterAnnotation(ParameterAnnotations obj);
214 
215     /**
216      * @since 6.0
217      */
218     void visitParameterAnnotationEntry(ParameterAnnotationEntry obj);
219 
220     void visitSignature(Signature obj);
221 
222     void visitSourceFile(SourceFile obj);
223 
224     void visitStackMap(StackMap obj);
225 
226     void visitStackMapEntry(StackMapEntry obj);
227 
228     /**
229      * Visits a {@link StackMapType} object.
230      * @param obj object to visit
231      * @since 6.8.0
232      */
233     default void visitStackMapType(final StackMapType obj) {
234       // empty
235     }
236 
237     void visitSynthetic(Synthetic obj);
238 
239     void visitUnknown(Unknown obj);
240 }