org.codehaus.commons.compiler
Interface ICookable

All Known Subinterfaces:
IClassBodyEvaluator, IExpressionEvaluator, IScriptEvaluator, ISimpleCompiler
All Known Implementing Classes:
ClassBodyEvaluator, ClassBodyEvaluator, Cookable, ExpressionEvaluator, ExpressionEvaluator, ScriptEvaluator, ScriptEvaluator, SimpleCompiler, SimpleCompiler

public interface ICookable

"Cooking" means scanning a sequence of characters and turning them into some JVM-executable artifact. For example, if you cook a ClassBodyEvaluator, then the tokens are interpreted as a class body and compiled into a Class which is accessible through IClassBodyEvaluator.getClazz().

The cook*() methods eventually invoke the abstract cook(String, Reader) method.


Field Summary
static java.lang.ClassLoader BOOT_CLASS_LOADER
          The ClassLoader that loads this classes on the boot class path, i.e.
static java.lang.String SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR
          Value 'org.codehaus.janino.source_debugging.dir'.
static java.lang.String SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE
          Value 'org.codehaus.janino.source_debugging.enable'.
 
Method Summary
 void cook(java.io.InputStream is)
          Reads, scans, parses and compiles Java tokens from the given InputStream, encoded in the "platform default encoding".
 void cook(java.io.InputStream is, java.lang.String optionalEncoding)
          Reads, scans, parses and compiles Java tokens from the given InputStream with the given encoding.
 void cook(java.io.Reader r)
          Reads, scans, parses and compiles Java tokens from the given Reader.
 void cook(java.lang.String s)
          Reads, scans, parses and compiles Java tokens from the given String.
 void cook(java.lang.String optionalFileName, java.io.InputStream is)
          Reads, scans, parses and compiles Java tokens from the given InputStream, encoded in the "platform default encoding".
 void cook(java.lang.String optionalFileName, java.io.InputStream is, java.lang.String optionalEncoding)
          Reads, scans, parses and compiles Java tokens from the given InputStream with the given encoding.
 void cook(java.lang.String optionalFileName, java.io.Reader r)
          Reads, scans, parses and compiles Java tokens from the given Reader.
 void cook(java.lang.String optionalFileName, java.lang.String s)
          Reads, scans, parses and compiles Java tokens from the given String.
 void cookFile(java.io.File file)
          Reads, scans, parses and compiles Java tokens from the given File, encoded in the "platform default encoding".
 void cookFile(java.io.File file, java.lang.String optionalEncoding)
          Reads, scans, parses and compiles Java tokens from the given File with the given encoding.
 void cookFile(java.lang.String fileName)
          Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".
 void cookFile(java.lang.String fileName, java.lang.String optionalEncoding)
          Reads, scans, parses and compiles Java tokens from the named file with the given encoding.
 void setDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars)
          Determines what kind of debugging information is included in the generates classes.
 void setParentClassLoader(java.lang.ClassLoader optionalParentClassLoader)
          The "parent class loader" is used to load referenced classes.
 

Field Detail

BOOT_CLASS_LOADER

static final java.lang.ClassLoader BOOT_CLASS_LOADER
The ClassLoader that loads this classes on the boot class path, i.e. the JARs in the JRE's "lib" and "lib/ext" directories, but not the JARs and class directories specified through the class path.


SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE

static final java.lang.String SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE
Value 'org.codehaus.janino.source_debugging.enable'.

Setting this system property to 'true' enables source-level debugging. Typically, this means that compilation is executed with '-g:all' instead of '-g:none'.

See Also:
Constant Field Values

SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR

static final java.lang.String SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR
Value 'org.codehaus.janino.source_debugging.dir'.

If source code is not compiled from a file, debuggers have a hard time locating the source file for source-level debugging. As a workaround, a copy of the source code is written to a temporary file, which must be included in the debugger's source path. If this system property is set, the temporary source file is created in that directory, otherwise in the default temporary-file directory.

See Also:
File.createTempFile(String, String, File), Constant Field Values
Method Detail

setParentClassLoader

void setParentClassLoader(java.lang.ClassLoader optionalParentClassLoader)
The "parent class loader" is used to load referenced classes. Useful values are:
System.getSystemClassLoader() The running JVM's class path
Thread.currentThread().getContextClassLoader() or null The class loader effective for the invoking thread
BOOT_CLASS_LOADER The running JVM's boot class path
The parent class loader defaults to the current thread's context class loader.


setDebuggingInformation

void setDebuggingInformation(boolean debugSource,
                             boolean debugLines,
                             boolean debugVars)
Determines what kind of debugging information is included in the generates classes. The default is typically '-g:none', and '-g:all' if the system property 'org.codehaus.janino.source_debugging.enable' is set to 'true'.


cook

void cook(java.lang.String optionalFileName,
          java.io.Reader r)
          throws CompileException,
                 java.io.IOException
Reads, scans, parses and compiles Java tokens from the given Reader.

Parameters:
optionalFileName - Used when reporting errors and warnings.
Throws:
CompileException
java.io.IOException

cook

void cook(java.io.Reader r)
          throws CompileException,
                 java.io.IOException
Reads, scans, parses and compiles Java tokens from the given Reader.

Throws:
CompileException
java.io.IOException

cook

void cook(java.io.InputStream is)
          throws CompileException,
                 java.io.IOException
Reads, scans, parses and compiles Java tokens from the given InputStream, encoded in the "platform default encoding".

Throws:
CompileException
java.io.IOException

cook

void cook(java.lang.String optionalFileName,
          java.io.InputStream is)
          throws CompileException,
                 java.io.IOException
Reads, scans, parses and compiles Java tokens from the given InputStream, encoded in the "platform default encoding".

Parameters:
optionalFileName - Used when reporting errors and warnings.
Throws:
CompileException
java.io.IOException

cook

void cook(java.io.InputStream is,
          java.lang.String optionalEncoding)
          throws CompileException,
                 java.io.IOException
Reads, scans, parses and compiles Java tokens from the given InputStream with the given encoding.

Throws:
CompileException
java.io.IOException

cook

void cook(java.lang.String optionalFileName,
          java.io.InputStream is,
          java.lang.String optionalEncoding)
          throws CompileException,
                 java.io.IOException
Reads, scans, parses and compiles Java tokens from the given InputStream with the given encoding.

Parameters:
optionalFileName - Used when reporting errors and warnings.
Throws:
CompileException
java.io.IOException

cook

void cook(java.lang.String s)
          throws CompileException
Reads, scans, parses and compiles Java tokens from the given String.

Throws:
CompileException

cook

void cook(java.lang.String optionalFileName,
          java.lang.String s)
          throws CompileException
Reads, scans, parses and compiles Java tokens from the given String.

Parameters:
optionalFileName - Used when reporting errors and warnings.
Throws:
CompileException

cookFile

void cookFile(java.io.File file)
              throws CompileException,
                     java.io.IOException
Reads, scans, parses and compiles Java tokens from the given File, encoded in the "platform default encoding".

Throws:
CompileException
java.io.IOException

cookFile

void cookFile(java.io.File file,
              java.lang.String optionalEncoding)
              throws CompileException,
                     java.io.IOException
Reads, scans, parses and compiles Java tokens from the given File with the given encoding.

Throws:
CompileException
java.io.IOException

cookFile

void cookFile(java.lang.String fileName)
              throws CompileException,
                     java.io.IOException
Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".

Throws:
CompileException
java.io.IOException

cookFile

void cookFile(java.lang.String fileName,
              java.lang.String optionalEncoding)
              throws CompileException,
                     java.io.IOException
Reads, scans, parses and compiles Java tokens from the named file with the given encoding.

Throws:
CompileException
java.io.IOException


Copyright © 2001-2011. All Rights Reserved.