public class JavaScriptExecutorRhino extends Object implements JavaScriptExecutor
| Constructor and Description |
|---|
JavaScriptExecutorRhino(String name)
This creates a new script environment with the optimization level set to
maximum.
|
JavaScriptExecutorRhino(String name,
Class<?> clazz)
This creates a new script environment with the optimization level set to
maximum.
|
JavaScriptExecutorRhino(String name,
int optimizationLevel)
This creates a new script environment.
|
JavaScriptExecutorRhino(String name,
int optimizationLevel,
Class<?> clazz)
This creates a new script environment.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCallScript(String source) |
void |
addGlobalFunction(String name,
Object object) |
void |
addGlobalFunction(String name,
Object object,
String method) |
void |
addScriptFile(String file) |
void |
addScriptFile(URL url) |
void |
addScriptSource(String source,
String name) |
void |
dispose() |
void |
run(Reader input,
Writer output) |
public JavaScriptExecutorRhino(String name)
name - The path of the script to addpublic JavaScriptExecutorRhino(String name, Class<?> clazz)
name - The path of the script to addclazz - The class used for resource resolvingpublic JavaScriptExecutorRhino(String name, int optimizationLevel)
name - The path of the script to addoptimizationLevel - The optimization level to use (-1 lowest, 9 highest)public JavaScriptExecutorRhino(String name, int optimizationLevel, Class<?> clazz)
name - The path of the script to addoptimizationLevel - The optimization level to use (-1 lowest, 9 highest)clazz - The class used for resource resolvingpublic final void addGlobalFunction(String name, Object object)
addGlobalFunction in interface JavaScriptExecutorname - The name to use of method to make availableobject - The object to make globally available in the environmentJavaScriptExecutor.addGlobalFunction(java.lang.String,
java.lang.Object)public final void addGlobalFunction(String name, Object object, String method)
addGlobalFunction in interface JavaScriptExecutorname - The name to use of method to make availableobject - The object to make globally available in the environmentmethod - The name of the method to publishJavaScriptExecutor.addGlobalFunction(java.lang.String,
java.lang.Object, java.lang.String)public void addScriptSource(String source, String name)
addScriptSource in interface JavaScriptExecutorsource - The source code of a script to addname - The name of the source for debugging/error reportingJavaScriptExecutor.addScriptSource(java.lang.String,
java.lang.String)public void addScriptFile(String file)
addScriptFile in interface JavaScriptExecutorfile - The path of the file to addJavaScriptExecutor.addScriptFile(java.lang.String)public void addScriptFile(URL url)
addScriptFile in interface JavaScriptExecutorurl - The URL to load the script fromJavaScriptExecutor.addScriptFile(java.net.URL)public void addCallScript(String source)
addCallScript in interface JavaScriptExecutorsource - The source script to evaluate. This should contain %s
where the reader input should be placed.JavaScriptExecutor.addCallScript(java.lang.String)public void run(Reader input, Writer output) throws IOException
run in interface JavaScriptExecutorinput - The execution input parametersoutput - The execution resultIOExceptionJavaScriptExecutor.run(java.io.Reader,
java.io.Writer)public void dispose()
dispose in interface JavaScriptExecutorJavaScriptExecutor.dispose()Copyright © 2013. All Rights Reserved.