Web Site

org.codehaus.janino
Class SimpleCompiler

java.lang.Object
  extended byorg.codehaus.janino.EvaluatorBase
      extended byorg.codehaus.janino.SimpleCompiler

public class SimpleCompiler
extends EvaluatorBase

A simplified version of Compiler that can compile only a single compilation unit. (A "compilation unit" is the characters stored in a ".java" file.)

Opposed to a normal ".java" file, you can declare multiple public classes here.


Constructor Summary
SimpleCompiler(Scanner scanner, ClassLoader optionalParentClassLoader)
          Parse a compilation unit from the given Scanner object and compile it to a set of JavaTM classes.
SimpleCompiler(String fileName)
           
SimpleCompiler(String optionalFileName, InputStream is)
           
SimpleCompiler(String optionalFileName, Reader in)
           
 
Method Summary
 ClassLoader getClassLoader()
          Returns a ClassLoader object through which the previously compiled classes can be accessed.
static void main(String[] args)
           
 
Methods inherited from class org.codehaus.janino.EvaluatorBase
addClassMethodBlockDeclaration, addPackageMemberClassDeclaration, classesToTypes, classToType, compileAndLoad, compileAndLoad, makeFormalParameters, parseImportDeclarations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCompiler

public SimpleCompiler(String optionalFileName,
                      Reader in)
               throws IOException,
                      Scanner.ScanException,
                      Parser.ParseException,
                      CompileException

SimpleCompiler

public SimpleCompiler(String optionalFileName,
                      InputStream is)
               throws IOException,
                      Scanner.ScanException,
                      Parser.ParseException,
                      CompileException

SimpleCompiler

public SimpleCompiler(String fileName)
               throws IOException,
                      Scanner.ScanException,
                      Parser.ParseException,
                      CompileException

SimpleCompiler

public SimpleCompiler(Scanner scanner,
                      ClassLoader optionalParentClassLoader)
               throws IOException,
                      Scanner.ScanException,
                      Parser.ParseException,
                      CompileException
Parse a compilation unit from the given Scanner object and compile it to a set of JavaTM classes.

Parameters:
scanner - Source of tokens
optionalParentClassLoader - Loads referenced classes
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

getClassLoader

public ClassLoader getClassLoader()
Returns a ClassLoader object through which the previously compiled classes can be accessed. This ClassLoader can be used for subsequent calls to SimpleCompiler(Scanner, ClassLoader) in order to compile compilation units that use types (e.g. declare derived types) declared in the previous one.


Web Site