1 16 package net.sf.cglib.transform; 17 18 import org.objectweb.asm.*; 19 20 public class ClassTransformerChain extends AbstractClassTransformer { 21 private ClassTransformer[] chain; 22 23 public ClassTransformerChain(ClassTransformer[] chain) { 24 this.chain = (ClassTransformer[])chain.clone(); 25 } 26 27 public void setTarget(ClassVisitor v) { 28 super.setTarget(chain[0]); 29 ClassVisitor next = v; 30 for (int i = chain.length - 1; i >= 0; i--) { 31 chain[i].setTarget(next); 32 next = chain[i]; 33 } 34 } 35 36 public MethodVisitor visitMethod(int access, 37 String name, 38 String desc, 39 String signature, 40 String [] exceptions) { 41 return cv.visitMethod(access, name, desc, signature, exceptions); 42 } 43 44 public String toString() { 45 StringBuffer sb = new StringBuffer (); 46 sb.append("ClassTransformerChain{"); 47 for (int i = 0; i < chain.length; i++) { 48 if (i > 0) { 49 sb.append(", "); 50 } 51 sb.append(chain[i].toString()); 52 } 53 sb.append("}"); 54 return sb.toString(); 55 } 56 } 57 | Popular Tags |