Package cn.com.bricks.custom.loader

Examples of cn.com.bricks.custom.loader.WmsClassLoader


     */
    @Test(invocationCount=1000,threadPoolSize=2)
    @SuppressWarnings("unchecked")
    public void testTransform() throws Exception {
        System.out.println("transform");
        WmsClassLoader loader = new WmsClassLoader(this.getClass().getClassLoader());
        String className = t.TU.class.getName().replace(".", "/");
        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});
//        r.getMethod("test3", new Class[]{String.class, String.class}).invoke(r.newInstance(), new Object[]{className, "test222"});
View Full Code Here

TOP

Related Classes of cn.com.bricks.custom.loader.WmsClassLoader

Copyright © 2018 www.massapicom. 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.