}
}
private byte[] generateProxy(Class<?> clsToProxy, String proxyName) throws ProxyGenerationException {
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
FieldVisitor fv;
MethodVisitor mv;
String clsToOverride = clsToProxy.getName().replaceAll("\\.", "/");
String proxyClassName = proxyName.replaceAll("\\.", "/");
// push class signature
cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, proxyClassName, null, clsToOverride, null);
cw.visitSource(clsToOverride + ".java", null);
// push InvocationHandler fields
fv = cw.visitField(ACC_FINAL + ACC_PRIVATE, BUSSINESS_HANDLER_NAME, "Ljava/lang/reflect/InvocationHandler;", null, null);
fv.visitEnd();
fv = cw.visitField(ACC_FINAL + ACC_PRIVATE, NON_BUSINESS_HANDLER_NAME, "Ljava/lang/reflect/InvocationHandler;", null, null);
fv.visitEnd();
// push single argument constructor
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/reflect/InvocationHandler;)V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);