Package 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 aClassBodyEvaluator, then the tokens are interpreted as a class body and compiled into aClasswhich is accessible throughIClassBodyEvaluator.getClazz().The
cook*()methods eventually invoke the abstractcook(String, Reader)method.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.ClassLoaderBOOT_CLASS_LOADERTheClassLoaderthat loads this classes on the boot class path, i.e.static java.lang.StringSYSTEM_PROPERTY_SOURCE_DEBUGGING_DIRValue 'org.codehaus.janino.source_debugging.dir'.static java.lang.StringSYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLEValue 'org.codehaus.janino.source_debugging.enable'.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcook(java.io.InputStream is)Reads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".voidcook(java.io.InputStream is, java.lang.String optionalEncoding)Reads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.voidcook(java.io.Reader r)Reads, scans, parses and compiles Java tokens from the givenReader.voidcook(java.lang.String s)Reads, scans, parses and compiles Java tokens from the givenString.voidcook(java.lang.String optionalFileName, java.io.InputStream is)Reads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".voidcook(java.lang.String optionalFileName, java.io.InputStream is, java.lang.String optionalEncoding)Reads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.voidcook(java.lang.String optionalFileName, java.io.Reader r)Reads, scans, parses and compiles Java tokens from the givenReader.voidcook(java.lang.String optionalFileName, java.lang.String s)Reads, scans, parses and compiles Java tokens from the givenString.voidcookFile(java.io.File file)Reads, scans, parses and compiles Java tokens from the givenFile, encoded in the "platform default encoding".voidcookFile(java.io.File file, java.lang.String optionalEncoding)Reads, scans, parses and compiles Java tokens from the givenFilewith the givenencoding.voidcookFile(java.lang.String fileName)Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".voidcookFile(java.lang.String fileName, java.lang.String optionalEncoding)Reads, scans, parses and compiles Java tokens from the named file with the givenencoding.voidsetDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars)Determines what kind of debugging information is included in the generates classes.voidsetParentClassLoader(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
TheClassLoaderthat 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:
The parent class loader defaults to the current thread's context class loader.System.getSystemClassLoader()The running JVM's class path Thread.currentThread().getContextClassLoader()ornullThe class loader effective for the invoking thread BOOT_CLASS_LOADERThe running JVM's boot class path
-
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.IOExceptionReads, scans, parses and compiles Java tokens from the givenReader.- Parameters:
optionalFileName- Used when reporting errors and warnings.- Throws:
CompileExceptionjava.io.IOException
-
cook
void cook(java.io.Reader r) throws CompileException, java.io.IOException
Reads, scans, parses and compiles Java tokens from the givenReader.- Throws:
CompileExceptionjava.io.IOException
-
cook
void cook(java.io.InputStream is) throws CompileException, java.io.IOException
Reads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".- Throws:
CompileExceptionjava.io.IOException
-
cook
void cook(java.lang.String optionalFileName, java.io.InputStream is) throws CompileException, java.io.IOExceptionReads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".- Parameters:
optionalFileName- Used when reporting errors and warnings.- Throws:
CompileExceptionjava.io.IOException
-
cook
void cook(java.io.InputStream is, java.lang.String optionalEncoding) throws CompileException, java.io.IOExceptionReads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.- Throws:
CompileExceptionjava.io.IOException
-
cook
void cook(java.lang.String optionalFileName, java.io.InputStream is, java.lang.String optionalEncoding) throws CompileException, java.io.IOExceptionReads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.- Parameters:
optionalFileName- Used when reporting errors and warnings.- Throws:
CompileExceptionjava.io.IOException
-
cook
void cook(java.lang.String s) throws CompileException
Reads, scans, parses and compiles Java tokens from the givenString.- Throws:
CompileException
-
cook
void cook(java.lang.String optionalFileName, java.lang.String s) throws CompileExceptionReads, scans, parses and compiles Java tokens from the givenString.- Parameters:
optionalFileName- Used when reporting errors and warnings.- Throws:
CompileException
-
cookFile
void cookFile(java.io.File file) throws CompileException, java.io.IOExceptionReads, scans, parses and compiles Java tokens from the givenFile, encoded in the "platform default encoding".- Throws:
CompileExceptionjava.io.IOException
-
cookFile
void cookFile(java.io.File file, java.lang.String optionalEncoding) throws CompileException, java.io.IOExceptionReads, scans, parses and compiles Java tokens from the givenFilewith the givenencoding.- Throws:
CompileExceptionjava.io.IOException
-
cookFile
void cookFile(java.lang.String fileName) throws CompileException, java.io.IOExceptionReads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".- Throws:
CompileExceptionjava.io.IOException
-
cookFile
void cookFile(java.lang.String fileName, java.lang.String optionalEncoding) throws CompileException, java.io.IOExceptionReads, scans, parses and compiles Java tokens from the named file with the givenencoding.- Throws:
CompileExceptionjava.io.IOException
-
-