001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.bcel.classfile; 018 019/** 020 * Interface to make use of the Visitor pattern programming style. I.e. a class that implements this interface can 021 * traverse the contents of a Java class just by calling the 'accept' method which all classes have. 022 */ 023public interface Visitor { 024 /** 025 * @since 6.0 026 */ 027 void visitAnnotation(Annotations obj); 028 029 /** 030 * @since 6.0 031 */ 032 void visitAnnotationDefault(AnnotationDefault obj); 033 034 /** 035 * @since 6.0 036 */ 037 void visitAnnotationEntry(AnnotationEntry obj); 038 039 /** 040 * @since 6.0 041 */ 042 void visitBootstrapMethods(BootstrapMethods obj); 043 044 void visitCode(Code obj); 045 046 void visitCodeException(CodeException obj); 047 048 void visitConstantClass(ConstantClass obj); 049 050 void visitConstantDouble(ConstantDouble obj); 051 052 /** 053 * @since 6.3 054 */ 055 default void visitConstantDynamic(final ConstantDynamic constantDynamic) { 056 // empty 057 } 058 059 void visitConstantFieldref(ConstantFieldref obj); 060 061 void visitConstantFloat(ConstantFloat obj); 062 063 void visitConstantInteger(ConstantInteger obj); 064 065 void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj); 066 067 void visitConstantInvokeDynamic(ConstantInvokeDynamic obj); 068 069 void visitConstantLong(ConstantLong obj); 070 071 /** 072 * @since 6.0 073 */ 074 void visitConstantMethodHandle(ConstantMethodHandle obj); 075 076 void visitConstantMethodref(ConstantMethodref obj); 077 078 /** 079 * @since 6.0 080 */ 081 void visitConstantMethodType(ConstantMethodType obj); 082 083 /** 084 * @since 6.1 085 */ 086 void visitConstantModule(ConstantModule constantModule); 087 088 void visitConstantNameAndType(ConstantNameAndType obj); 089 090 /** 091 * @since 6.1 092 */ 093 void visitConstantPackage(ConstantPackage constantPackage); 094 095 void visitConstantPool(ConstantPool obj); 096 097 void visitConstantString(ConstantString obj); 098 099 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 /** 217 * @since 6.0 218 */ 219 void visitParameterAnnotationEntry(ParameterAnnotationEntry obj); 220 221 /** 222 * Visits a {@link Record} object. 223 * 224 * @param obj Record to visit 225 * @since 6.9.0 226 */ 227 default void visitRecord(final Record obj) { 228 // empty 229 } 230 231 /** 232 * Visits a {@link RecordComponentInfo} object. 233 * 234 * @param record component to visit 235 * @since 6.9.0 236 */ 237 default void visitRecordComponent(final RecordComponentInfo record) { 238 // noop 239 } 240 241 void visitSignature(Signature obj); 242 243 void visitSourceFile(SourceFile obj); 244 245 void visitStackMap(StackMap obj); 246 247 void visitStackMapEntry(StackMapEntry obj); 248 249 /** 250 * Visits a {@link StackMapType} object. 251 * 252 * @param obj object to visit 253 * @since 6.8.0 254 */ 255 default void visitStackMapType(final StackMapType obj) { 256 // empty 257 } 258 259 void visitSynthetic(Synthetic obj); 260 261 void visitUnknown(Unknown obj); 262 263}