1 54 package org.logicalcobwebs.cglib.core; 55 56 import org.logicalcobwebs.asm.ClassWriter; 57 58 public class DefaultGeneratorStrategy implements GeneratorStrategy { 59 public static final DefaultGeneratorStrategy INSTANCE = new DefaultGeneratorStrategy(); 60 61 public byte[] generate(ClassGenerator cg) throws Exception { 62 ClassWriter cw = getClassWriter(); 63 transform(cg).generateClass(cw); 64 return transform(cw.toByteArray()); 65 } 66 67 protected ClassWriter getClassWriter() throws Exception { 68 return new DebuggingClassWriter(true); 69 } 70 71 protected byte[] transform(byte[] b) throws Exception { 72 return b; 73 } 74 75 protected ClassGenerator transform(ClassGenerator cg) throws Exception { 76 return cg; 77 } 78 } 79 | Popular Tags |