1 package net.sf.cglib.transform;
2
3 import org.objectweb.asm.*;
4
5 public class ClassFilterTransformer extends AbstractClassTransformer {
6 private ClassTransformer pass;
7 private ClassFilter filter;
8 private ClassVisitor target;
9
10 public void setTarget(ClassVisitor target) {
11 super.setTarget(target);
12 pass.setTarget(target);
13 }
14
15 public ClassFilterTransformer(ClassFilter filter, ClassTransformer pass) {
16 this.pass = pass;
17 this.filter = filter;
18 }
19
20 public void visit(int access, String name, String superName, String[] interfaces, String sourceFile) {
21 target = filter.accept(name) ? pass : cv;
22 target.visit(access, name, superName, interfaces, sourceFile);
23 }
24
25 public void visitEnd() {
26 target.visitEnd();
27 target = null; // just to be safe
28 }
29
30 public void visitField(int access, String name, String desc, Object value, Attribute attrs) {
31 target.visitField(access, name, desc, value, attrs);
32 }
33
34 public void visitInnerClass(String name, String outerName, String innerName, int access) {
35 target.visitInnerClass(name, outerName, innerName, access);
36 }
37
38 public CodeVisitor visitMethod(int access, String name, String desc, String[] exceptions, Attribute attrs) {
39 return target.visitMethod(access, name, desc, exceptions, attrs);
40 }
41
42 public void visitAttribute(Attribute attrs) {
43 target.visitAttribute(attrs);
44 }
45 }
This page was automatically generated by Maven