Package org.apache.xbean.asm

Examples of org.apache.xbean.asm.ClassWriter.toByteArray()


        BufferedInputStream bis = new BufferedInputStream(bais);

        ClassWriter cw = new BCClassWriter(ClassWriter.COMPUTE_FRAMES, bc.getClassLoader());
        ClassReader cr = new ClassReader(bis);
        cr.accept(cw, 0);
        return cw.toByteArray();
    }

    private static class BCClassWriter extends ClassWriter {
        private final ClassLoader _loader;
View Full Code Here


                    processMethod(cw, method, proxyClassName, NON_BUSINESS_HANDLER_NAME);
                }
        }
    }
   
    byte[] clsBytes = cw.toByteArray();
    return clsBytes;
  }

  /*
   * Return all protected, public, and default methods of a given class
View Full Code Here

                    processMethod(cw, method, proxyClassName, NON_BUSINESS_HANDLER_NAME);
                }
        }
    }
   
    byte[] clsBytes = cw.toByteArray();
    return clsBytes;
  }

  /*
   * Return all protected, public, and default methods of a given class
View Full Code Here

    Method[] methods = clsToProxy.getDeclaredMethods();
    for (Method method : methods) {
      processMethod(cw, method, proxyClassName, clsToOverride);
    }
   
    byte[] clsBytes = cw.toByteArray();
    return clsBytes;
  }


  private void processMethod(ClassWriter cw, Method method, String proxyName, String clsToOverride) throws ProxyGenerationException {
View Full Code Here

        if (interceptedMethods != null)
        {
            delegateInterceptedMethods(classLoader, cw, proxyClassFileName, classToProxy, interceptedMethods);
        }

        return cw.toByteArray();
    }


    /**
     * The 'defineClass' method on the ClassLoader is protected, thus we need to invoke it via reflection.
View Full Code Here

        FieldAdderClassVisitor visitor = new FieldAdderClassVisitor(classWriter);

        ClassReader classReader = new ClassReader(origBytes);
        classReader.accept(visitor, 0);

        byte[] newBytes = classWriter.toByteArray();
        return newBytes;
    }

    public static class FieldAdderClassVisitor extends ClassAdapter {
        public FieldAdderClassVisitor(ClassVisitor classVisitor) {
View Full Code Here

                    processMethod(cw, method, proxyClassFileName, NON_BUSINESS_HANDLER_NAME);
                }
            }
        }

        return cw.toByteArray();
    }

    private static void getNonPrivateMethods(Class<?> clazz, Map<String, List<Method>> methodMap) {
        while (clazz != null) {
            for (Method method : clazz.getDeclaredMethods()) {
View Full Code Here

                    processMethod(cw, method, proxyClassFileName, NON_BUSINESS_HANDLER_NAME);
                }
            }
        }

        return cw.toByteArray();
    }

    private static void propagateConstructors(Class<?> classToProxy, ClassWriter cw, String classFileName) {
        for (Constructor<?> constructor : classToProxy.getDeclaredConstructors()) {
View Full Code Here

                    processMethod(cw, method, proxyClassFileName, NON_BUSINESS_HANDLER_NAME);
                }
            }
        }

        return cw.toByteArray();
    }

    private static void propagateConstructors(Class<?> classToProxy, ClassWriter cw, String classFileName) {
        for (Constructor<?> constructor : classToProxy.getDeclaredConstructors()) {
View Full Code Here

                    processMethod(cw, method, proxyClassFileName, NON_BUSINESS_HANDLER_NAME);
                }
            }
        }

        return cw.toByteArray();
    }

    private static void getNonPrivateMethods(Class<?> clazz, Map<String, List<Method>> methodMap) {
        while (clazz != null) {
            for (Method method : clazz.getDeclaredMethods()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.