JavaTM Platform
Standard Ed. 6

javax.script
클래스 SimpleScriptContext

java.lang.Object 
  상위를 확장 javax.script.SimpleScriptContext
모든 구현된 인터페이스:
ScriptContext


public class SimpleScriptContext
extends Object
implements ScriptContext

ScriptContext 의 단순한 구현입니다.

도입된 버젼:
1.6

필드의 개요
protected  Bindings engineScope
          이것은, 엔진 스코프 바인딩입니다.
protected  Writer errorWriter
          이것은, 스크립트로부터의 출력 에러에 사용되는 라이터입니다.
protected  Bindings globalScope
          이것은, 글로벌 스코프의 바인딩입니다.
protected  Reader reader
          이것은, 스크립트로부터의 입력에 사용되는 리더입니다.
protected  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
 

필드의 상세

writer

protected Writer  writer
이것은, 스크립트로부터의 출력에 사용되는 라이터입니다. 디폴트에서는,System.out 에 근거한 PrintWriter 가 사용됩니다. 이 필드의 관리에는, 액세스용 메소드 getWriter 및 setWriter 가 사용됩니다.

관련 항목:
System.out , PrintWriter

errorWriter

protected Writer  errorWriter
이것은, 스크립트로부터의 출력 에러에 사용되는 라이터입니다. 디폴트에서는,System.err 에 근거한 PrintWriter 가 사용됩니다. 이 필드의 관리에는, 액세스용 메소드 getErrorWriter 및 setErrorWriter 가 사용됩니다.

관련 항목:
System.err , PrintWriter

reader

protected Reader  reader
이것은, 스크립트로부터의 입력에 사용되는 리더입니다. 디폴트에서는,System.in 에 근거한 InputStreamReader 가 사용됩니다. 이 리더는, 디폴트의 캐릭터 세트를 사용합니다. 이 필드의 관리에는, 액세스용 메소드 getReader 및 setReader 가 사용됩니다.

관련 항목:
System.in , InputStreamReader

engineScope

protected Bindings  engineScope
이것은, 엔진 스코프 바인딩입니다. 디폴트에서는,SimpleBindings 가 사용됩니다. 이 필드의 관리에는, 액세스용 메소드 setBindings 및 getBindings 가 사용됩니다.

관련 항목:
SimpleBindings

globalScope

protected Bindings  globalScope
이것은, 글로벌 스코프의 바인딩입니다. 디폴트에서는, null 치 (즉 글로벌 스코프 없음)가 사용됩니다. 이 필드의 관리에는, 액세스용 메소드 setBindings 및 getBindings 가 사용됩니다.

생성자 의 상세

SimpleScriptContext

public SimpleScriptContext()
메소드의 상세

setBindings

public void setBindings(Bindings  bindings,
                        int scope)
지정된 스코프의 속성의 Bindings 를 설정합니다. 스코프의 값이 ENGINE_SCOPE 인 경우, 지정된 BindingsengineScope 필드를 치환합니다. 스코프의 값이 GLOBAL_SCOPE 인 경우, 지정된 BindingsglobalScope 필드를 치환합니다.

정의:
인터페이스 ScriptContext 내의 setBindings
파라미터:
bindings - 설정하는 속성의 Bindings.
scope - 속성이 설정되는 스코프의 값.
예외:
IllegalArgumentException - 스코프가 무효인 경우.
NullPointerException - 스코프의 값이 ENGINE_SCOPE 로, 지정된 Bindings 가 null 의 경우.

getAttribute

public Object  getAttribute(String  name)
스코프내에서, 지정된 이름을 가지는 속성의 값을 검색해, 최초로 발견된 것을 가져옵니다. 검색의 순서는, 스코프 파라미터의 수치에 의해 정해집니다 (최소의 스코프치가 앞).

정의:
인터페이스 ScriptContext 내의 getAttribute
파라미터:
name - 취득하는 속성의 이름.
반환값:
지정된 이름을 가지는 속성이 정의되고 있는 최소의 스코프내의 속성치. 지정된 이름을 가지는 속성이 어느 스코프에도 존재하지 않는 경우는 null.
예외:
NullPointerException - 이름이 null 의 경우.
IllegalArgumentException - 이름이 빈 상태(empty)의 경우.

getAttribute

public Object  getAttribute(String  name,
                           int scope)
지정된 스코프내의 속성의 값을 가져옵니다.

정의:
인터페이스 ScriptContext 내의 getAttribute
파라미터:
name - 취득하는 속성의 이름.
scope - 속성을 취득하는 스코프.
반환값:
속성의 값. 지정된 스코프내에 이름이 존재하지 않는 경우는 null.
예외:
IllegalArgumentException - name 가 빈 상태(empty)의 경우, 또는 스코프의 값이 무효의 경우.
NullPointerException - 이름이 null 의 경우.

removeAttribute

public Object  removeAttribute(String  name,
                              int scope)
지정된 스코프내의 속성을 삭제합니다.

정의:
인터페이스 ScriptContext 내의 removeAttribute
파라미터:
name - 삭제하는 속성의 이름
scope - 속성을 삭제하는 스코프
반환값:
삭제된 값.
예외:
IllegalArgumentException - name 가 빈 상태(empty)의 경우, 또는 스코프가 무효의 경우.
NullPointerException - 이름이 null 의 경우.

setAttribute

public void setAttribute(String  name,
                         Object  value,
                         int scope)
지정된 스코프내의 속성의 값을 설정합니다.

정의:
인터페이스 ScriptContext 내의 setAttribute
파라미터:
name - 설정하는 속성의 이름
value - 속성의 값
scope - 속성을 설정하는 스코프
예외:
IllegalArgumentException - name 가 빈 상태(empty)의 경우, 또는 스코프가 무효의 경우.
NullPointerException - 이름이 null 의 경우.

getWriter

public Writer  getWriter()
출력을 표시할 경우에 사용하는 스크립트의 Writer 를 돌려줍니다.

정의:
인터페이스 ScriptContext 내의 getWriter
반환값:
Writer

getReader

public Reader  getReader()
입력을 읽어들이기 위해서(때문에) 스크립트가 사용하는 Reader 를 돌려줍니다.

정의:
인터페이스 ScriptContext 내의 getReader
반환값:
Reader

setReader

public void setReader(Reader  reader)
입력을 읽어들이기 위한 스크립트의 Reader 를 설정합니다.

정의:
인터페이스 ScriptContext 내의 setReader
파라미터:
reader - 새로운 Reader

setWriter

public void setWriter(Writer  writer)
출력을 표시할 경우에 사용하는 스크립트의 Writer 를 설정합니다.

정의:
인터페이스 ScriptContext 내의 setWriter
파라미터:
writer - 새로운 Writer

getErrorWriter

public Writer  getErrorWriter()
에러 출력을 표시할 경우에 사용하는 Writer 를 돌려줍니다.

정의:
인터페이스 ScriptContext 내의 getErrorWriter
반환값:
Writer

setErrorWriter

public void setErrorWriter(Writer  writer)
에러 출력을 표시할 경우에 사용하는 Writer 를 설정합니다.

정의:
인터페이스 ScriptContext 내의 setErrorWriter
파라미터:
writer - Writer

getAttributesScope

public int getAttributesScope(String  name)
속성이 정의되고 있는 최소의 스코프를 가져옵니다.

정의:
인터페이스 ScriptContext 내의 getAttributesScope
파라미터:
name - 속성의 이름 .
반환값:
최소의 스코프. 지정된 이름을 가지는 속성이 어느 스코프에서도 정의되어 있지 않은 경우는 -1.
예외:
NullPointerException - name 가 null 의 경우.
IllegalArgumentException - name 가 빈 상태(empty)의 경우.

getBindings

public Bindings  getBindings(int scope)
지정된 스코프가 ENGINE_SCOPE 의 경우,engineScope 필드의 값을 돌려줍니다. 지정된 스코프가 GLOBAL_SCOPE 의 경우,globalScope 필드의 값을 돌려줍니다.

정의:
인터페이스 ScriptContext 내의 getBindings
파라미터:
scope - 지정된 스코프
반환값:
engineScope 또는 globalScope 필드의 값.
예외:
IllegalArgumentException - 스코프의 값이 무효인 경우.

getScopes

public List <Integer > getScopes()
ScriptContext 내의 스코프에 대한, 모든 유효치의 불변의 List 를 돌려줍니다.

정의:
인터페이스 ScriptContext 내의 getScopes
반환값:
스코프치의 리스트

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.