@Test public void test() throws IOException, ClassFormatException { ClassReader reader = new ClassReader(HelloWorld.class.getCanonicalName()); reader.accept(new ClassVisitor(JBEL_1) { @Override public void visit(int version, int access, String className, String superClassName, String signature) { log("Version: " + version); log("AccessFlags: " + Integer.toHexString(access)); log("ClassName: " + className); log("SuperClassName: " + superClassName); log("Signature: " + signature); super.visit(version, access, className, superClassName, signature); } }); print(reader); }
public void accept(ClassVisitor visitor) throws ClassFormatException { int version = this.getMajor(); int accessFlags = this.getAccessFlags(); String className = this.getClassName(); String superClassName = this.getSuperClassName(); String signature = null; visitor.visit(version, accessFlags, className, superClassName, signature); visitor.visitConstantPool(this.constantPool); for(Interface iface : this.interfaces) { visitor.visitInterface(iface); } visitor.visitInterfaces(this.interfaces); for(FieldInfo field : this.fields) { visitField(visitor, field); } visitor.visitFields(this.fields); for(Attribute attribute : this.attributes) { visitor.visitAttribute(attribute); } visitor.visitAttributes(this.attributes); }
ClassReader implements Opcode { public void accept(ClassVisitor visitor) throws ClassFormatException { int version = this.getMajor(); int accessFlags = this.getAccessFlags(); String className = this.getClassName(); String superClassName = this.getSuperClassName(); String signature = null; visitor.visit(version, accessFlags, className, superClassName, signature); visitor.visitConstantPool(this.constantPool); for(Interface iface : this.interfaces) { visitor.visitInterface(iface); } visitor.visitInterfaces(this.interfaces); for(FieldInfo field : this.fields) { visitField(visitor, field); } visitor.visitFields(this.fields); for(Attribute attribute : this.attributes) { visitor.visitAttribute(attribute); } visitor.visitAttributes(this.attributes); } }
ClassReader implements Opcode { public void accept(ClassVisitor visitor) throws ClassFormatException { int version = this.getMajor(); int accessFlags = this.getAccessFlags(); String className = this.getClassName(); String superClassName = this.getSuperClassName(); String signature = null; visitor.visit(version, accessFlags, className, superClassName, signature); visitor.visitConstantPool(this.constantPool); for(Interface iface : this.interfaces) { visitor.visitInterface(iface); } visitor.visitInterfaces(this.interfaces); for(FieldInfo field : this.fields) { visitField(visitor, field); } visitor.visitFields(this.fields); for(Attribute attribute : this.attributes) { visitor.visitAttribute(attribute); } visitor.visitAttributes(this.attributes); } ClassReader(final byte[] bytes);  ClassReader(final byte[] bytes, final int offset, final int length);  ClassReader(final String source);  ClassReader(final InputStream inputStream); }
ClassReader implements Opcode { public void accept(ClassVisitor visitor) throws ClassFormatException { int version = this.getMajor(); int accessFlags = this.getAccessFlags(); String className = this.getClassName(); String superClassName = this.getSuperClassName(); String signature = null; visitor.visit(version, accessFlags, className, superClassName, signature); visitor.visitConstantPool(this.constantPool); for(Interface iface : this.interfaces) { visitor.visitInterface(iface); } visitor.visitInterfaces(this.interfaces); for(FieldInfo field : this.fields) { visitField(visitor, field); } visitor.visitFields(this.fields); for(Attribute attribute : this.attributes) { visitor.visitAttribute(attribute); } visitor.visitAttributes(this.attributes); } ClassReader(final byte[] bytes);  ClassReader(final byte[] bytes, final int offset, final int length);  ClassReader(final String source);  ClassReader(final InputStream inputStream); byte[] getByteCode(); void write(File file); final void write(DataOutputStream codeStream); Class defineClass(); int getMagic(); int getMinor(); int getMajor(); ConstantPool getConstantPool(); int getAccessFlags(); String getClassName(); int getClassNameIndex(); String getSuperClassName(); int getSuperClassNameIndex(); ArrayList<Interface> getInterfaces(); ArrayList<FieldInfo> getFields(); ArrayList<MethodInfo> getMethods(); ArrayList<Attribute> getAttributes(); void accept(ClassVisitor visitor); }
ClassReader implements Opcode { public void accept(ClassVisitor visitor) throws ClassFormatException { int version = this.getMajor(); int accessFlags = this.getAccessFlags(); String className = this.getClassName(); String superClassName = this.getSuperClassName(); String signature = null; visitor.visit(version, accessFlags, className, superClassName, signature); visitor.visitConstantPool(this.constantPool); for(Interface iface : this.interfaces) { visitor.visitInterface(iface); } visitor.visitInterfaces(this.interfaces); for(FieldInfo field : this.fields) { visitField(visitor, field); } visitor.visitFields(this.fields); for(Attribute attribute : this.attributes) { visitor.visitAttribute(attribute); } visitor.visitAttributes(this.attributes); } ClassReader(final byte[] bytes);  ClassReader(final byte[] bytes, final int offset, final int length);  ClassReader(final String source);  ClassReader(final InputStream inputStream); byte[] getByteCode(); void write(File file); final void write(DataOutputStream codeStream); Class defineClass(); int getMagic(); int getMinor(); int getMajor(); ConstantPool getConstantPool(); int getAccessFlags(); String getClassName(); int getClassNameIndex(); String getSuperClassName(); int getSuperClassNameIndex(); ArrayList<Interface> getInterfaces(); ArrayList<FieldInfo> getFields(); ArrayList<MethodInfo> getMethods(); ArrayList<Attribute> getAttributes(); void accept(ClassVisitor visitor);  }