Package cn.com.bricks.dynamic.weaving

Examples of cn.com.bricks.dynamic.weaving.UnitTestTransformer.transform()


        Class<?> classBeingRedefined = null;
        Class c = Class.forName(className.replace("/", "."));
        byte[] classfileBuffer = loader.loadClassData(className);
        UnitTestTransformer instance = new UnitTestTransformer();
        byte[] expResult = null;
        byte[] result = instance.transform(c.getClassLoader(), className, classBeingRedefined, null, classfileBuffer);
        Class r = loader.getInstance(className.replace("/", "."), result);
//        r.getConstructor(new Class[]{String.class});
//        System.out.println(r.getMethods()[0].toString());
        r.getMethod("test", new Class[]{String.class}).invoke(r.newInstance(), new Object[]{"teeeee"});
//        r.getMethod("test1", new Class[]{String.class, boolean.class}).invoke(r.newInstance(), new Object[]{className + "test1", true});
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.