public class SimpleScriptContext extends Object implements ScriptContext
| 修飾子と型 | フィールドと説明 |
|---|---|
protected Bindings |
engineScope
これは、エンジンスコープバインディングです。
|
protected Writer |
errorWriter
これは、スクリプトからの出力エラーに使用されるライターです。
|
protected Bindings |
globalScope
これは、グローバルスコープのバインディングです。
|
protected Reader |
reader
これは、スクリプトからの入力に使用されるリーダーです。
|
protected Writer |
writer
これは、スクリプトからの出力に使用されるライターです。
|
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 を設定します。 |
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 が使用されます。protected Bindings engineScope
SimpleBindings が使用されます。このフィールドの管理には、アクセス用メソッド setBindings および getBindings が使用されます。SimpleBindingsprotected Bindings globalScope
public void setBindings(Bindings bindings, int scope)
Bindings を設定します。スコープの値が ENGINE_SCOPE である場合、指定された Bindings が engineScope フィールドを置換します。スコープの値が GLOBAL_SCOPE である場合、指定された Bindings が globalScope フィールドを置換します。setBindings、インタフェース: ScriptContextbindings - 設定する属性の Bindings。scope - 属性が設定されるスコープの値。IllegalArgumentException - スコープが無効な場合。NullPointerException - スコープの値が ENGINE_SCOPE で、指定された Bindings が null の場合。public Object getAttribute(String name)
getAttribute、インタフェース: ScriptContextname - 取得する属性の名前。NullPointerException - 名前が null の場合。IllegalArgumentException - 名前が空の場合。public Object getAttribute(String name, int scope)
getAttribute、インタフェース: ScriptContextname - 取得する属性の名前。scope - 属性を取得するスコープ。null。IllegalArgumentException - name が空の場合、またはスコープの値が無効の場合。NullPointerException - 名前が null の場合。public Object removeAttribute(String name, int scope)
removeAttribute、インタフェース: ScriptContextname - 削除する属性の名前scope - 属性を削除するスコープIllegalArgumentException - name が空の場合、またはスコープが無効の場合。NullPointerException - 名前が null の場合。public void setAttribute(String name, Object value, int scope)
setAttribute、インタフェース: ScriptContextname - 設定する属性の名前value - 属性の値scope - 属性を設定するスコープIllegalArgumentException - name が空の場合、またはスコープが無効の場合。NullPointerException - 名前が null の場合。public Writer getWriter()
Writer を返します。getWriter、インタフェース: ScriptContextWriter。public Reader getReader()
Reader を返します。getReader、インタフェース: ScriptContextReader。public void setReader(Reader reader)
Reader を設定します。setReader、インタフェース: ScriptContextreader - 新しい Reader。public void setWriter(Writer writer)
Writer を設定します。setWriter、インタフェース: ScriptContextwriter - 新しい Writer。public Writer getErrorWriter()
Writer を返します。getErrorWriter、インタフェース: ScriptContextWriterpublic void setErrorWriter(Writer writer)
Writer を設定します。setErrorWriter、インタフェース: ScriptContextwriter - Writer。public int getAttributesScope(String name)
getAttributesScope、インタフェース: ScriptContextname - 属性の名前。NullPointerException - name が null の場合。IllegalArgumentException - name が空の場合。public Bindings getBindings(int scope)
ENGINE_SCOPE の場合、engineScope フィールドの値を返します。指定されたスコープが GLOBAL_SCOPE の場合、globalScope フィールドの値を返します。getBindings、インタフェース: ScriptContextscope - 指定されたスコープengineScope または globalScope フィールドの値。IllegalArgumentException - スコープの値が無効な場合。public List<Integer> getScopes()
List を返します。getScopes、インタフェース: ScriptContext バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.