View Javadoc
1 package net.sf.cglib.transform.hook; 2 3 import java.util.Hashtable; 4 import net.sf.cglib.core.*; 5 import net.sf.cglib.transform.*; 6 import org.codehaus.aspectwerkz.hook.ClassPreProcessor; 7 import org.objectweb.asm.ClassReader; 8 import org.objectweb.asm.ClassWriter; 9 10 abstract public class AbstractPreProcessor implements ClassPreProcessor { 11 public void initialize(Hashtable hashtable) { 12 } 13 14 public byte[] preProcess(String name, byte[] abyte, ClassLoader caller) { 15 try { 16 ClassTransformer t = getClassTransformer(name); 17 if (t == null) 18 return abyte; 19 ClassWriter w = new DebuggingClassWriter(true); 20 ClassGenerator gen = new ClassReaderGenerator(new ClassReader(abyte), false); 21 gen = new TransformingClassGenerator(gen, t); 22 gen.generateClass(w); 23 return w.toByteArray(); 24 } catch (Exception e) { 25 throw new CodeGenerationException(e); 26 } 27 } 28 29 abstract protected ClassTransformer getClassTransformer(String name); 30 }

This page was automatically generated by Maven