Package org.codehaus.janino

Examples of org.codehaus.janino.SimpleCompiler.cook()


  public static void main(String args[]) throws Exception{
   
    StringBuffer classContext = new StringBuffer();
    classContext.append("public class TestClass{ String a;}");
    SimpleCompiler compiler = new SimpleCompiler();
    compiler.cook(new StringBufferInputStream(classContext.toString()));
    Class testcls = compiler.getClassLoader().loadClass("TestClass");
    System.out.println(testcls);
   
   
   
View Full Code Here


        String clsName = (String)clsNames.get(0);
       
        SimpleCompiler compiler = new SimpleCompiler();
    compiler.setParentClassLoader(GlobalContext.class.getClassLoader());
    compiler.cook(new ByteArrayInputStream(javaSource.getBytes()));
    //compiler.getClassLoader().
   
    classLoader = compiler.getClassLoader();
    typeClass = classLoader.loadClass(clsName);
   
View Full Code Here

        }
       
        SimpleCompiler compiler = new SimpleCompiler();
        for( SourceCode sc : sources ){
            try {
                compiler.cook(sc.getSourceCode());
            } catch (CompileException ex) {
                Logger.getLogger(JaninoCompiler.class.getName()).log(Level.SEVERE, null, ex);
                throw new Error(ex);
            }
        }
View Full Code Here

                AMap.class.getName() + " contextOld, " +
                AMap.class.getName() + " contextNew, " +
                APath.class.getName() + " path, boolean isDerived) throws Exception {",
                codeForDiff.getCode());

        compiler.cook(builder.build());
        final Class omCls = compiler.getClassLoader().loadClass(builder.fqn);

        // this assumes only one constructor. Seems a somewhat brittle, but no reason comes to mind why there should
        //  every be more than one
        final Constructor ctor = omCls.getConstructors()[0];
View Full Code Here

                AMap.class.getName() + " contextOld, " +
                AMap.class.getName() + " contextNew, " +
                APath.class.getName() + " path, boolean isDerived) throws Exception {",
                codeForDiff.getCode());

        compiler.cook(builder.build());
        final Class omCls = compiler.getClassLoader().loadClass(builder.fqn);

        // this assumes only one constructor. Seems a somewhat brittle, but no reason comes to mind why there should
        //  every be more than one
        final Constructor ctor = omCls.getConstructors()[0];
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.