1 16 package net.sf.cglib.transform; 17 18 import org.objectweb.asm.*; 19 20 abstract public class AbstractClassFilterTransformer extends AbstractClassTransformer { 21 private ClassTransformer pass; 22 private ClassVisitor target; 23 24 public void setTarget(ClassVisitor target) { 25 super.setTarget(target); 26 pass.setTarget(target); 27 } 28 29 protected AbstractClassFilterTransformer(ClassTransformer pass) { 30 this.pass = pass; 31 } 32 33 abstract protected boolean accept(int version, int access, String name, String signature, String superName, String [] interfaces); 34 35 public void visit(int version, 36 int access, 37 String name, 38 String signature, 39 String superName, 40 String [] interfaces) { 41 target = accept(version, access, name, signature, superName, interfaces) ? pass : cv; 42 target.visit(version, access, name, signature, superName, interfaces); 43 } 44 45 public void visitSource(String source, String debug) { 46 target.visitSource(source, debug); 47 } 48 49 public void visitOuterClass(String owner, String name, String desc) { 50 target.visitOuterClass(owner, name, desc); 51 } 52 53 public AnnotationVisitor visitAnnotation(String desc, boolean visible) { 54 return target.visitAnnotation(desc, visible); 55 } 56 57 public void visitAttribute(Attribute attr) { 58 target.visitAttribute(attr); 59 } 60 61 public void visitInnerClass(String name, String outerName, String innerName, int access) { 62 target.visitInnerClass(name, outerName, innerName, access); 63 } 64 65 public FieldVisitor visitField(int access, 66 String name, 67 String desc, 68 String signature, 69 Object value) { 70 return target.visitField(access, name, desc, signature, value); 71 } 72 73 public MethodVisitor visitMethod(int access, 74 String name, 75 String desc, 76 String signature, 77 String [] exceptions) { 78 return target.visitMethod(access, name, desc, signature, exceptions); 79 } 80 81 public void visitEnd() { 82 target.visitEnd(); 83 target = null; } 85 } 86 | Popular Tags |