public class SourceCompiler
extends java.lang.Object
| Constructor and Description |
|---|
SourceCompiler() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<?> |
getClass(java.lang.String packageAndClassName)
Get the class object for the given name.
|
javax.script.CompiledScript |
getCompiledScript(java.lang.String packageAndClassName)
Get the compiled script.
|
java.lang.reflect.Method |
getMethod(java.lang.String className)
Get the first public static method of the given class.
|
static boolean |
isJavaxScriptSource(java.lang.String source)
Whether the passed source can be compiled using
ScriptEngineManager. |
void |
setJavaSystemCompiler(boolean enabled)
Enable or disable the usage of the Java system compiler.
|
void |
setSource(java.lang.String className,
java.lang.String source)
Set the source code for the specified class.
|
public void setSource(java.lang.String className,
java.lang.String source)
className - the class namesource - the source codepublic void setJavaSystemCompiler(boolean enabled)
enabled - true to enablepublic java.lang.Class<?> getClass(java.lang.String packageAndClassName)
throws java.lang.ClassNotFoundException
packageAndClassName - the class namejava.lang.ClassNotFoundExceptionpublic static boolean isJavaxScriptSource(java.lang.String source)
ScriptEngineManager.source - the source to test.true if getCompiledScript(String) can be called.public javax.script.CompiledScript getCompiledScript(java.lang.String packageAndClassName)
throws javax.script.ScriptException
packageAndClassName - the package and class namejavax.script.ScriptExceptionpublic java.lang.reflect.Method getMethod(java.lang.String className)
throws java.lang.ClassNotFoundException
className - the class namejava.lang.ClassNotFoundException