|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.script.SimpleScriptContext
public class SimpleScriptContext
ScriptContext 的簡單實作。
| 欄位摘要 | |
|---|---|
protected Bindings |
engineScope
此欄位是引擎範圍 bindings。 |
protected Writer |
errorWriter
此欄位是用於文稿輸出錯誤的 writer。 |
protected Bindings |
globalScope
此欄位是全體範圍 bindings。 |
protected Reader |
reader
此欄位是用於文稿輸入的 reader。 |
protected Writer |
writer
此欄位是用於文稿輸出的 writer。 |
| 從介面 javax.script.ScriptContext 繼承的欄位 |
|---|
ENGINE_SCOPE, GLOBAL_SCOPE |
| 建構子摘要 | |
|---|---|
SimpleScriptContext()
|
|
| 方法摘要 | |
|---|---|
Object |
getAttribute(String name)
獲取範圍中按搜尋順序最早出現的具有給定名稱的屬性的值。 |
Object |
getAttribute(String name,
int scope)
獲取給定範圍中某一屬性的值。 |
int |
getAttributesScope(String name)
獲取用來定義屬性的最小範圍。 |
Bindings |
getBindings(int scope)
如果指定範圍為 ENGINE_SCOPE,則返回 engineScope 欄位的值。 |
Writer |
getErrorWriter()
返回用來顯示錯誤輸出的 Writer。 |
Reader |
getReader()
返回文稿用來讀取輸入的 Reader。 |
List<Integer> |
getScopes()
返回 ScriptContext 中所有有效範圍值的不可變 List。 |
Writer |
getWriter()
返回文稿的 Writer,以便在顯示輸出時使用。 |
Object |
removeAttribute(String name,
int scope)
移除給定範圍中的某一屬性。 |
void |
setAttribute(String name,
Object value,
int scope)
設置給定範圍中某一屬性的值。 |
void |
setBindings(Bindings bindings,
int scope)
針對給定範圍設置屬性的 Bindings。 |
void |
setErrorWriter(Writer writer)
設置用來顯示錯誤輸出的 Writer。 |
void |
setReader(Reader reader)
設置文稿的 Reader,以讀取輸入。 |
void |
setWriter(Writer writer)
設置文稿的 Writer,以便在顯示輸出時使用。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 欄位詳細資訊 |
|---|
protected Writer writer
System.out 的 PrintWriter。可使用存取方法 getWriter 和 setWriter 來管理此欄位。
System.out,
PrintWriterprotected Writer errorWriter
System.err 的 PrintWriter。可使用存取方法 getErrorWriter 和 setErrorWriter 來管理此欄位。
System.err,
PrintWriterprotected Reader reader
System.in 的 InputStreamReader 和預設字元集。可使用存取方法 getReader 和 setReader 來管理此欄位。
System.in,
InputStreamReaderprotected Bindings engineScope
SimpleBindings。可使用存取方法 setBindings 和 getBindings 來管理此欄位。
SimpleBindingsprotected Bindings globalScope
| 建構子詳細資訊 |
|---|
public SimpleScriptContext()
| 方法詳細資訊 |
|---|
public void setBindings(Bindings bindings,
int scope)
Bindings。如果範圍值為 ENGINE_SCOPE,則使用給定 Bindings 替代 engineScope 欄位。如果範圍值為 GLOBAL_SCOPE,則使用給定 Bindings 替換 globalScope 欄位。
ScriptContext 中的 setBindingsbindings - 要設置的屬性的 Bindings。scope - 範圍值,將在該範圍中設置屬性。
IllegalArgumentException - 如果 scope 無效。
NullPointerException - 如果 scope 的值為 ENGINE_SCOPE 並且指定的 Bindings 為 null。public Object getAttribute(String name)
ScriptContext 中的 getAttributename - 要獲取的屬性的名稱。
NullPointerException - 如果 name 為 null。
IllegalArgumentException - 如果 name 為空。
public Object getAttribute(String name,
int scope)
ScriptContext 中的 getAttributename - 要獲取的屬性名稱。scope - 將在其中獲取屬性的範圍。
null 表示 name 不存在於給定範圍中。
IllegalArgumentException - 如果 name 為空,或者 scope 的值無效。
NullPointerException - 如果 name 為 null。
public Object removeAttribute(String name,
int scope)
ScriptContext 中的 removeAttributename - 要移除的屬性的名稱scope - 移除屬性的範圍
IllegalArgumentException - 如果 name 為空,或者 scope 無效。
NullPointerException - 如果 name 為 null。
public void setAttribute(String name,
Object value,
int scope)
ScriptContext 中的 setAttributename - 要設置的屬性的名稱value - 屬性值scope - 屬性的設置範圍
IllegalArgumentException - 如果 name 為空,或者 scope 無效。
NullPointerException - 如果 name 為 null。public Writer getWriter()
Writer,以便在顯示輸出時使用。
ScriptContext 中的 getWriterWriter。public Reader getReader()
Reader。
ScriptContext 中的 getReaderReader。public void setReader(Reader reader)
Reader,以讀取輸入。
ScriptContext 中的 setReaderreader - 新的 Reader。public void setWriter(Writer writer)
Writer,以便在顯示輸出時使用。
ScriptContext 中的 setWriterwriter - 新的 Writer。public Writer getErrorWriter()
Writer。
ScriptContext 中的 getErrorWriterWriterpublic void setErrorWriter(Writer writer)
Writer。
ScriptContext 中的 setErrorWriterwriter - Writer。public int getAttributesScope(String name)
ScriptContext 中的 getAttributesScopename - 屬性的名稱。
NullPointerException - 如果 name 為 null。
IllegalArgumentException - 如果 name 為空。public Bindings getBindings(int scope)
ENGINE_SCOPE,則返回 engineScope 欄位的值。如果指定範圍為 GLOBAL_SCOPE,則返回 globalScope 欄位的值。
ScriptContext 中的 getBindingsscope - 指定範圍
engineScope 或 globalScope 欄位的值。
IllegalArgumentException - 如果 scope 的值無效。public List<Integer> getScopes()
List。
ScriptContext 中的 getScopes
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。