public class SourceCompiler extends Object
| 构造器和说明 |
|---|
SourceCompiler() |
| 限定符和类型 | 方法和说明 |
|---|---|
Class<?> |
getClass(String packageAndClassName)
Get the class object for the given name.
|
CompiledScript |
getCompiledScript(String packageAndClassName)
Get the compiled script.
|
Method |
getMethod(String className)
Get the first public static method of the given class.
|
static boolean |
isJavaxScriptSource(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(String className,
String source)
Set the source code for the specified class.
|
public void setSource(String className, String source)
className - the class namesource - the source codepublic void setJavaSystemCompiler(boolean enabled)
enabled - true to enablepublic Class<?> getClass(String packageAndClassName) throws ClassNotFoundException
packageAndClassName - the class nameClassNotFoundException - on failurepublic static boolean isJavaxScriptSource(String source)
ScriptEngineManager.source - the source to test.true if getCompiledScript(String) can be called.public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException
packageAndClassName - the package and class nameScriptException - on failurepublic Method getMethod(String className) throws ClassNotFoundException
className - the class nameClassNotFoundException - on failureCopyright © 2022. All rights reserved.