001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.bcel.classfile; 020 021/** 022 * Interface to make use of the Visitor pattern programming style. I.e. a class that implements this interface can 023 * traverse the contents of a Java class just by calling the 'accept' method which all classes have. 024 */ 025public interface Visitor { 026 /** 027 * @since 6.0 028 */ 029 void visitAnnotation(Annotations obj); 030 031 /** 032 * @since 6.0 033 */ 034 void visitAnnotationDefault(AnnotationDefault obj); 035 036 /** 037 * @since 6.0 038 */ 039 void visitAnnotationEntry(AnnotationEntry obj); 040 041 /** 042 * @since 6.0 043 */ 044 void visitBootstrapMethods(BootstrapMethods obj); 045 046 void visitCode(Code obj); 047 048 void visitCodeException(CodeException obj); 049 050 void visitConstantClass(ConstantClass obj); 051 052 void visitConstantDouble(ConstantDouble obj); 053 054 /** 055 * @since 6.3 056 */ 057 default void visitConstantDynamic(final ConstantDynamic constantDynamic) { 058 // empty 059 } 060 061 void visitConstantFieldref(ConstantFieldref obj); 062 063 void visitConstantFloat(ConstantFloat obj); 064 065 void visitConstantInteger(ConstantInteger obj); 066 067 void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj); 068 069 void visitConstantInvokeDynamic(ConstantInvokeDynamic obj); 070 071 void visitConstantLong(ConstantLong obj); 072 073 /** 074 * @since 6.0 075 */ 076 void visitConstantMethodHandle(ConstantMethodHandle obj); 077 078 void visitConstantMethodref(ConstantMethodref obj); 079 080 /** 081 * @since 6.0 082 */ 083 void visitConstantMethodType(ConstantMethodType obj); 084 085 /** 086 * @since 6.1 087 */ 088 void visitConstantModule(ConstantModule constantModule); 089 090 void visitConstantNameAndType(ConstantNameAndType obj); 091 092 /** 093 * @since 6.1 094 */ 095 void visitConstantPackage(ConstantPackage constantPackage); 096 097 void visitConstantPool(ConstantPool obj); 098 099 void visitConstantString(ConstantString obj); 100 101 void visitConstantUtf8(ConstantUtf8 obj); 102 103 void visitConstantValue(ConstantValue obj); 104 105 void visitDeprecated(Deprecated obj); 106 107 /** 108 * @since 6.0 109 */ 110 void visitEnclosingMethod(EnclosingMethod obj); 111 112 void visitExceptionTable(ExceptionTable obj); 113 114 void visitField(Field obj); 115 116 void visitInnerClass(InnerClass obj); 117 118 void visitInnerClasses(InnerClasses obj); 119 120 void visitJavaClass(JavaClass obj); 121 122 void visitLineNumber(LineNumber obj); 123 124 void visitLineNumberTable(LineNumberTable obj); 125 126 void visitLocalVariable(LocalVariable obj); 127 128 void visitLocalVariableTable(LocalVariableTable obj); 129 130 /** 131 * @since 6.0 132 */ 133 void visitLocalVariableTypeTable(LocalVariableTypeTable obj); 134 135 void visitMethod(Method obj); 136 137 /** 138 * @since 6.4.0 139 */ 140 default void visitMethodParameter(final MethodParameter obj) { 141 // empty 142 } 143 144 /** 145 * @since 6.0 146 */ 147 void visitMethodParameters(MethodParameters obj); 148 149 /** 150 * @since 6.4.0 151 */ 152 default void visitModule(final Module constantModule) { 153 // empty 154 } 155 156 /** 157 * @since 6.4.0 158 */ 159 default void visitModuleExports(final ModuleExports constantModule) { 160 // empty 161 } 162 163 /** 164 * @since 6.4.0 165 */ 166 default void visitModuleMainClass(final ModuleMainClass obj) { 167 // empty 168 } 169 170 /** 171 * @since 6.4.0 172 */ 173 default void visitModuleOpens(final ModuleOpens constantModule) { 174 // empty 175 } 176 177 /** 178 * @since 6.4.0 179 */ 180 default void visitModulePackages(final ModulePackages constantModule) { 181 // empty 182 } 183 184 /** 185 * @since 6.4.0 186 */ 187 default void visitModuleProvides(final ModuleProvides constantModule) { 188 // empty 189 } 190 191 /** 192 * @since 6.4.0 193 */ 194 default void visitModuleRequires(final ModuleRequires constantModule) { 195 // empty 196 } 197 198 /** 199 * @since 6.4.0 200 */ 201 default void visitNestHost(final NestHost obj) { 202 // empty 203 } 204 205 /** 206 * @since 6.4.0 207 */ 208 default void visitNestMembers(final NestMembers obj) { 209 // empty 210 } 211 212 /** 213 * @since 6.0 214 */ 215 void visitParameterAnnotation(ParameterAnnotations obj); 216 217 /** 218 * @since 6.0 219 */ 220 void visitParameterAnnotationEntry(ParameterAnnotationEntry obj); 221 222 /** 223 * Visits a {@link Record} object. 224 * 225 * @param obj Record to visit 226 * @since 6.9.0 227 */ 228 default void visitRecord(final Record obj) { 229 // empty 230 } 231 232 /** 233 * Visits a {@link RecordComponentInfo} object. 234 * 235 * @param record component to visit 236 * @since 6.9.0 237 */ 238 default void visitRecordComponent(final RecordComponentInfo record) { 239 // noop 240 } 241 242 void visitSignature(Signature obj); 243 244 void visitSourceFile(SourceFile obj); 245 246 void visitStackMap(StackMap obj); 247 248 void visitStackMapEntry(StackMapEntry obj); 249 250 /** 251 * Visits a {@link StackMapType} object. 252 * 253 * @param obj object to visit 254 * @since 6.8.0 255 */ 256 default void visitStackMapType(final StackMapType obj) { 257 // empty 258 } 259 260 void visitSynthetic(Synthetic obj); 261 262 void visitUnknown(Unknown obj); 263 264}