public abstract class AbstractScriptEngine extends Object implements ScriptEngine
eval
变体标准实施。
eval(Reader)
eval(String)
eval(String, Bindings)
eval(Reader, Bindings)
使用抽象方法
eval(Reader,ScriptContext)
或eval(String, ScriptContext)
与SimpleScriptContext
实施。
一SimpleScriptContext
作为默认的ScriptContext
的AbstractScriptEngine
..
Modifier and Type | Field and Description |
---|---|
protected ScriptContext |
context
这
AbstractScriptEngine 默认
ScriptContext 。
|
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME
Constructor and Description |
---|
AbstractScriptEngine()
创建一个新实例abstractscriptengine使用
SimpleScriptContext 作为其默认
ScriptContext 。
|
AbstractScriptEngine(Bindings n)
使用指定的
Bindings 在保护
context 领域
ENGINE_SCOPE
Bindings 创建一个新的实例。
|
Modifier and Type | Method and Description |
---|---|
Object |
eval(Reader reader)
eval(Reader) 调用摘要
eval(Reader, ScriptContext) 路过的
context 字段的值。
|
Object |
eval(Reader reader, Bindings bindings)
eval(Reader, Bindings) 调用摘要
eval(Reader, ScriptContext) 方法,通过这一
ScriptContext 的读者,其他
ENGINE_SCOPE 是那些受保护的
context 字段成员的相同范围的作家和绑定。
|
Object |
eval(String script)
同
eval(Reader) 除了抽象的
eval(String, ScriptContext) 使用。
|
Object |
eval(String script, Bindings bindings)
同
eval(Reader, Bindings) 除了抽象的
eval(String, ScriptContext) 使用。
|
Object |
get(String key)
获取在保护
context 领域
ENGINE_SCOPE 指定关键字的值。
|
Bindings |
getBindings(int scope)
返回与指定范围值在保护
context 领域
Bindings 。
|
ScriptContext |
getContext()
返回保护
context 字段的值。
|
protected ScriptContext |
getScriptContext(Bindings nn)
返回一个
SimpleScriptContext 。
|
void |
put(String key, Object value)
在受保护的
context 领域
ENGINE_SCOPE
Bindings 指定键指定的值集。
|
void |
setBindings(Bindings bindings, int scope)
在
context 场对应的范围值
Bindings 集。
|
void |
setContext(ScriptContext ctxt)
设置指定的
ScriptContext 的保护
context 字段的值。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createBindings, eval, eval, getFactory
protected ScriptContext context
AbstractScriptEngine
默认
ScriptContext
。
public AbstractScriptEngine()
SimpleScriptContext
作为其默认
ScriptContext
。
public AbstractScriptEngine(Bindings n)
Bindings
在保护
context
领域
ENGINE_SCOPE
Bindings
创建一个新的实例。
n
-指定
Bindings
。
NullPointerException
如果n是零。
public void setContext(ScriptContext ctxt)
ScriptContext
的保护
context
字段的值。
setContext
接口
ScriptEngine
ctxt
-指定
ScriptContext
。
NullPointerException
-如果ctxt是空的。
public ScriptContext getContext()
context
字段的值。
getContext
接口
ScriptEngine
context
字段的值。
public Bindings getBindings(int scope)
context
领域
Bindings
。
getBindings
接口
ScriptEngine
scope
-指定范围
Bindings
。
IllegalArgumentException
如果范围的值的类型的保护
context
字段无效。
public void setBindings(Bindings bindings, int scope)
context
场对应的范围值
Bindings
集。
setBindings
接口
ScriptEngine
bindings
-指定
Bindings
。
scope
-指定范围。
IllegalArgumentException
如果范围的值的类型
context
字段无效。
NullPointerException
如果绑定无效的范围
ScriptContext.ENGINE_SCOPE
public void put(String key, Object value)
context
领域
ENGINE_SCOPE
Bindings
指定键指定的值集。
put
接口
ScriptEngine
key
-指定键。
value
-指定值。
NullPointerException
如果关键是空的。
IllegalArgumentException
如果关键是空的。
public Object get(String key)
context
领域
ENGINE_SCOPE
指定关键字的值。
get
接口
ScriptEngine
key
-关键的值被返回
NullPointerException
如果关键是空的。
IllegalArgumentException
如果关键是空的。
public Object eval(Reader reader, Bindings bindings) throws ScriptException
eval(Reader, Bindings)
调用摘要
eval(Reader, ScriptContext)
方法,通过这一
ScriptContext
的读者,其他
ENGINE_SCOPE
是那些受保护的
context
字段成员的相同范围的作家和绑定。指定的
Bindings
代替的
context
领域
ENGINE_SCOPE
Bindings
。
eval
接口
ScriptEngine
reader
-
Reader
包含脚本的源。
bindings
-
Bindings
用于
ENGINE_SCOPE
脚本执行时。
eval(Reader, ScriptContext)
返回值
ScriptException
-如果在脚本发生错误。
NullPointerException
如果任一参数为空。
public Object eval(String script, Bindings bindings) throws ScriptException
eval(Reader, Bindings)
除了抽象的
eval(String, ScriptContext)
使用。
eval
接口
ScriptEngine
script
-
String
包含脚本的源。
bindings
-
Bindings
作为
ENGINE_SCOPE
脚本执行时。
eval(String, ScriptContext)
返回值
ScriptException
-如果在脚本发生错误。
NullPointerException
如果任一参数为空。
public Object eval(Reader reader) throws ScriptException
eval(Reader)
调用摘要
eval(Reader, ScriptContext)
路过的
context
字段的值。
eval
接口
ScriptEngine
reader
-
Reader
包含脚本的源。
eval(Reader, ScriptContext)
返回值
ScriptException
-如果在脚本发生错误。
NullPointerException
如果任一参数为空。
public Object eval(String script) throws ScriptException
eval(Reader)
除了抽象的
eval(String, ScriptContext)
使用。
eval
接口
ScriptEngine
script
-
String
包含脚本的源。
eval(String, ScriptContext)
返回值
ScriptException
-如果在脚本发生错误。
NullPointerException
如果任一参数为空。
protected ScriptContext getScriptContext(Bindings nn)
SimpleScriptContext
。的
SimpleScriptContext
:
ENGINE_SCOPE
Bindings
Bindings
返回的摘要getGlobalScope
方法为GLOBAL_SCOPE
ScriptEngine
默认ScriptContext
SimpleScriptContext
返回此方法用于实现eval方法摘要
eval(Reader,Bindings)
和
eval(String,Bindings)
版本。
nn
绑定使用的
ENGINE_SCOPE
SimpleScriptContext
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.