1 16 package net.sf.cglib.core; 17 18 import org.objectweb.asm.ClassWriter; 19 20 public class DefaultGeneratorStrategy implements GeneratorStrategy { 21 public static final DefaultGeneratorStrategy INSTANCE = new DefaultGeneratorStrategy(); 22 23 public byte[] generate(ClassGenerator cg) throws Exception { 24 ClassWriter cw = getClassWriter(); 25 transform(cg).generateClass(cw); 26 return transform(cw.toByteArray()); 27 } 28 29 protected ClassWriter getClassWriter() throws Exception { 30 return new DebuggingClassWriter(true); 31 } 32 33 protected byte[] transform(byte[] b) throws Exception { 34 return b; 35 } 36 37 protected ClassGenerator transform(ClassGenerator cg) throws Exception { 38 return cg; 39 } 40 } 41 | Popular Tags |