public class V8ScriptRunner extends AbstractScriptRunner
| Constructor and Description |
|---|
V8ScriptRunner() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
callMethod(Object obj,
String name,
Class<T> resultType,
Object... args)
Calls an object's method
|
void |
callMethod(Object obj,
String name,
Object... args)
Calls an object's method
|
<T> T |
callMethod(String name,
Class<T> resultType,
Object... args)
Calls a top-level method
|
void |
callMethod(String name,
Object... args)
Calls a top-level method
|
<T> T |
convert(Object r,
Class<T> resultType)
Tries to convert the given object to the given type
|
JsonBuilder |
createJsonBuilder() |
void |
eval(Reader reader)
Executes a script provided by a given reader
|
String |
getName() |
String |
getVersion() |
void |
release() |
loadScriptpublic void release()
public String getName()
public String getVersion()
public void eval(Reader reader) throws ScriptRunnerException, IOException
ScriptRunnerreader - the readerScriptRunnerException - if the script could not be executedIOException - if the script could not be read from the readerpublic <T> T callMethod(String name, Class<T> resultType, Object... args) throws ScriptRunnerException
ScriptRunnerT - the type of the return valuename - the method's nameresultType - the expected type of the return valueargs - the argumentsScriptRunnerException - if the method could not be calledpublic void callMethod(String name, Object... args) throws ScriptRunnerException
ScriptRunnername - the method's nameargs - the argumentsScriptRunnerException - if the method could not be calledpublic <T> T callMethod(Object obj, String name, Class<T> resultType, Object... args) throws ScriptRunnerException
ScriptRunnerT - the type of the return valueobj - the objectname - the method's nameresultType - the expected type of the return valueargs - the argumentsScriptRunnerException - if the method could not be calledpublic void callMethod(Object obj, String name, Object... args) throws ScriptRunnerException
ScriptRunnerobj - the objectname - the method's nameargs - the argumentsScriptRunnerException - if the method could not be calledpublic <T> T convert(Object r, Class<T> resultType)
ScriptRunnerT - the type to convert tor - the object to convertresultType - the type to convert topublic JsonBuilder createJsonBuilder()