org.fun4j.compiler
Class Compiler

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.fun4j.compiler.Compiler

public class Compiler
extends java.lang.ClassLoader

The fun4j functional AST to Java ByteCode compiler. This class provides methods to compile Expression objects into Function instances. The Function.apply(Object...) method will invoke the compiled AST expression.

Author:
Thomas Mahler

Field Summary
static boolean writeFile
           
 
Constructor Summary
Compiler()
          The public constructor is used to set up the parent classloader hierarchy in the proper way.
 
Method Summary
 Function compile(Expression expr, java.lang.String name)
          compiles an expression into an executable Function.
 long getCount()
           
static java.lang.Boolean setUseBigInts(java.lang.Boolean newValue)
           
static java.lang.Boolean setWriteFile(java.lang.Boolean newValue)
           
static boolean useBigInts()
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writeFile

public static boolean writeFile
Constructor Detail

Compiler

public Compiler()
The public constructor is used to set up the parent classloader hierarchy in the proper way. If this was not done the Compiler would cause classloading issues in OSGI plugins.

Method Detail

setUseBigInts

public static java.lang.Boolean setUseBigInts(java.lang.Boolean newValue)

useBigInts

public static boolean useBigInts()

setWriteFile

public static java.lang.Boolean setWriteFile(java.lang.Boolean newValue)

getCount

public long getCount()

compile

public Function compile(Expression expr,
                        java.lang.String name)
                 throws CompilationException
compiles an expression into an executable Function.

Parameters:
expr - the expression to compile
name - the name to be used for the Java class
Returns:
the compiled Function
Throws:
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
CompilationException