public interface Invocable
Modifier and Type | Method and Description |
---|---|
<T> T |
getInterface(类<T> clasz)
返回在解释器中编译的函数的接口的实现。
|
<T> T |
getInterface(Object thiz, 类<T> clasz)
返回在解释器中编译的脚本对象的成员函数返回一个接口的实现。
|
Object |
invokeFunction(String name, Object... args)
用于调用脚本中定义的顶级程序和函数。
|
Object |
invokeMethod(Object thiz, String name, Object... args)
调用在编译脚本对象上执行脚本中的方法,这是保留的
ScriptEngine 状态。
|
Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException
ScriptEngine
状态。
name
-程序的名字叫。
thiz
如果程序是在脚本和即时定义一个类成员的类返回之前执行或调用的一个实例,通过实例的命名方法,称为。
args
-参数传递给程序。将参数转换为脚本变量的规则是实现特定的。
ScriptException
如果方法调用期间发生错误。
NoSuchMethodException
如果给定名称或匹配参数类型不能被发现的方法。
NullPointerException
如果方法名是空的。
IllegalArgumentException
-如果指定的首长是无效的或指定的对象并不代表一个脚本对象。
Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException
name
-打电话
args
-参数传递到过程或函数
ScriptException
如果方法调用期间发生错误。
NoSuchMethodException
如果给定名称或匹配参数类型不能被发现的方法。
NullPointerException
如果方法名为空。
<T> T getInterface(类<T> clasz)
invokeFunction
方法实现。
T
-返回的接口的类型
clasz
-返回接口的
类
对象。
ScriptEngine
不能。
IllegalArgumentException
-如果指定
类
对象为空或不是一个接口。
<T> T getInterface(Object thiz, 类<T> clasz)
invokeMethod
方法实现。
T
-返回的接口的类型
thiz
-脚本对象的成员函数来实现该接口的方法。
clasz
-返回接口的
类
对象。
ScriptEngine
不能。
IllegalArgumentException
-如果指定
类
对象为空或不是一个接口,或指定对象是否为空或不代表一个脚本对象。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.