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()
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が使用されます。System.in、InputStreamReaderprotected 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, 2014, Oracle and/or its affiliates. All rights reserved.