source.ucregents.playground
Class CodeCompiler

java.lang.Object
  extended by source.ucregents.playground.CodeCompiler

public final class CodeCompiler
extends java.lang.Object

This class handles aspects of dynamically compiled code, including storing and creating the dynamic classes themselves.


Constructor Summary
CodeCompiler()
           
 
Method Summary
static boolean Compile(java.lang.String targetClassName, java.lang.String containedCode, java.lang.String classDeclarationAppendix)
          Compiles a new class and adds it as a temporary file into the class/ directory for use elsewhere Requires write access into the class/ directory.
static java.lang.Class GetClassFor(java.lang.String s)
           
static java.util.Hashtable<java.lang.String,java.lang.Class> getConversionTable()
          The Conversion table that converts from the given 'friendly' string to the internal class
static java.lang.String getLastError()
           
static boolean isCompiling()
           
static void setCompiling(boolean compiling)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeCompiler

public CodeCompiler()
Method Detail

Compile

public static final boolean Compile(java.lang.String targetClassName,
                                    java.lang.String containedCode,
                                    java.lang.String classDeclarationAppendix)
Compiles a new class and adds it as a temporary file into the class/ directory for use elsewhere Requires write access into the class/ directory. For referencing the true name of the class within the class itself, for example, in constructors, use %THISCLASS% and it'll be automagically replaced with the true classname.

Parameters:
targetClassName - The friendly & desired name for the class
containedCode - A string containing the desired code WITHIN the initial brackets of the class
classDeclarationAppendix - A string containing the declatations of a class, specifically, the Implements and Extends keywords
Returns:
Returns a boolean indicating the status of the compilation. True means that the compile succeeded. If false, look inside getLastError for a string containg an errorMessage

GetClassFor

public static java.lang.Class GetClassFor(java.lang.String s)
Parameters:
s - The 'friendly' name of the class to find
Returns:
Returns the class object if found, otherwise it returns null

getConversionTable

public static final java.util.Hashtable<java.lang.String,java.lang.Class> getConversionTable()
The Conversion table that converts from the given 'friendly' string to the internal class


getLastError

public static java.lang.String getLastError()

isCompiling

public static final boolean isCompiling()

setCompiling

public static final void setCompiling(boolean compiling)