Examples of defineClass()


Examples of cn.wensiqun.asmsupport.loader.ASMClassLoader.defineClass()

    protected Class<?> loadClass(String name, byte[] b) {
        Class<?> clazz = null;
        try {
          ASMClassLoader loader = ASMClassLoader.asmClassLoader;
          clazz = loader.defineClass(name, b);
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
        return clazz;
View Full Code Here

Examples of com.facebook.presto.byteCode.DynamicClassLoader.defineClass()

        DynamicClassLoader classLoader = new DynamicClassLoader();
        ClassWriter cw = new SmartClassWriter(ClassInfoLoader.createClassInfoLoader(ImmutableList.of(classDefinition), classLoader));
        classDefinition.visit(cw);

        Class<?> clazz = classLoader.defineClass(classDefinition.getType().getJavaClassName(), cw.toByteArray());
        return clazz.getMethod("test").invoke(null);
    }
}
View Full Code Here

Examples of com.intellij.ant.PseudoClassLoader.defineClass()

        if (loader != null) {
          final String className = out.getClassName();
          if (className != null) {
            //noinspection SynchronizationOnLocalVariableOrMethodParameter
            synchronized (loader) {
              loader.defineClass(className.replace('.', '/'), out.getContent().toByteArray());
            }
          }
        }
      }
    });
View Full Code Here

Examples of com.subhajit.codeanalysis.BeanCreator.defineClass()

    // field.
    if (bean != null && bean.getClass().isArray()) {
      try {
        BeanCreator c = new BeanCreator(new URLClassLoader(new URL[0],
            Thread.currentThread().getContextClassLoader()));
        Object superBean = c.defineClass(
            "com.subhajit.foo.A"
                + UUID.randomUUID().toString()
                    .replace('-', 'A') + ".tempClass",
            new String[] { "arrayElements" },
            new Class<?>[] { bean.getClass() }).newInstance();
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.ClassDefiner.defineClass()

    byte[] byteCode = new byte[list.size()];
    int index = 0;
    for (byte value : list) {
      byteCode[index++] = value;
    }
    final Class<?> clazz = classDefiner.defineClass(className, byteCode);
    // final Object object=clazz.newInstance();
    final Object object = helperReflect.newInstanceNoConstruction(clazz);

    // final IProxyCallBack proxyCallBack = (IProxyCallBack) object;
    final IProxyCallBack proxyCallBack = IProxyCallBack.class.cast(object);
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.GeneratedClassLoader.defineClass()

           nameEnd = path.length();
       }
       String name = path.substring(nameStart, nameEnd);
       try {
           GeneratedClassLoader loader = SecurityController.createLoader(cx.getApplicationClassLoader(), securityDomain);
           Class clazz = loader.defineClass(name, data);
           loader.linkClass(clazz);
           if (!Script.class.isAssignableFrom(clazz)) {
               throw Context.reportRuntimeError("msg.must.implement.Script");
           }
           return (Script) clazz.newInstance();
View Full Code Here

Examples of org.allspice.util.ImmediateClassLoader.defineClass()

  public static void main(String[] args) throws Exception {
    // Create the java class
    JavaClass jc = GenJavaClass.createJavaClass(makeAddClass()) ;
    // Use a utility loader so we can call our class without saving to disk
    ImmediateClassLoader loader = new ImmediateClassLoader() ;
    loader.defineClass(jc.getClassName(),jc.getBytes()) ;
    // Load the honest to goodness class
    Class<?> cl = loader.loadClass("TestClass") ;
    // Create an instance of the class.
    Object o = cl.newInstance() ;
    // Get the "add" method
View Full Code Here

Examples of org.apache.tapestry.enhance.EnhancedClassLoader.defineClass()

        String enhancedClassName = getClassName();
        byte[] enhancedClassBytes = cf.getByteCode();

        EnhancedClassLoader loader = _classFactory.getEnhancedClassLoader();
        return loader.defineClass(
            enhancedClassName,
            enhancedClassBytes,
            _parentClass.getProtectionDomain());
    }
View Full Code Here

Examples of org.apache.tapestry.enhance.EnhancedClassLoader.defineClass()

       
        String enhancedClassName = getClassName();
        byte[] enhancedClassBytes = cf.getByteCode();
       
        EnhancedClassLoader loader = _classFactory.getEnhancedClassLoader();
        return loader.defineClass(enhancedClassName, enhancedClassBytes);
    }

}
View Full Code Here

Examples of org.cojen.classfile.RuntimeClassFile.defineClass()

            throw new IllegalArgumentException("No methods in factory to implement");
        }

        F instance;
        try {
            instance = (F) cf.defineClass().newInstance();
        } catch (IllegalAccessException e) {
            throw new UndeclaredThrowableException(e);
        } catch (InstantiationException e) {
            throw new UndeclaredThrowableException(e);
        }
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.