This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.script
class SimpleScriptContext

java.lang.Object extended by javax.script.SimpleScriptContext
All Implemented Interfaces:
ScriptContext

Most common way to construct:

SimpleScriptContext tempctxt = new SimpleScriptContext();

Based on 9 examples


public class SimpleScriptContext
extends Object
implements ScriptContext

Simple implementation of ScriptContext.


Field Summary
protected Bindings engineScope
          This is the engine scope bindings.
protected Writer errorWriter
          This is the writer to be used to output errors from scripts.
protected Bindings globalScope
          This is the global scope bindings.
protected Reader reader
          This is the reader to be used for input from scripts.
protected Writer writer
          This is the writer to be used to output from scripts.
 
Constructor Summary

          
 
Method Summary
 Object

          Retrieves the value of the attribute with the given name in the scope occurring earliest in the search order.
 Object
getAttribute(String name, int scope)

          Gets the value of an attribute in a given scope.
 int

          Get the lowest scope in which an attribute is defined.
 Bindings
getBindings(int scope)

          Returns the value of the engineScope field if specified scope is ENGINE_SCOPE.
 Writer

          
 Reader

          
 List

          
 Writer

          
 Object
removeAttribute(String name, int scope)

          Remove an attribute in a given scope.
 void
setAttribute(String name, Object value, int scope)

          Sets the value of an attribute in a given scope.
 void
setBindings(Bindings bindings, int scope)

          Sets a Bindings of attributes for the given scope.
 void

          
 void
setReader(Reader reader)

          
 void
setWriter(Writer writer)

          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

engineScope

protected Bindings engineScope
This is the engine scope bindings. By default, a SimpleBindings is used. Accessor methods setBindings, getBindings are used to manage this field.

errorWriter

protected Writer errorWriter
This is the writer to be used to output errors from scripts. By default, a PrintWriter based on System.err is used. Accessor methods getErrorWriter, setErrorWriter are used to manage this field.

globalScope

protected Bindings globalScope
This is the global scope bindings. By default, a null value (which means no global scope) is used. Accessor methods setBindings, getBindings are used to manage this field.

reader

protected Reader reader
This is the reader to be used for input from scripts. By default, a InputStreamReader based on System.in is used and default charset is used by this reader. Accessor methods getReader, setReader are used to manage this field.

writer

protected Writer writer
This is the writer to be used to output from scripts. By default, a PrintWriter based on System.out is used. Accessor methods getWriter, setWriter are used to manage this field.
Constructor Detail

SimpleScriptContext

public SimpleScriptContext()
Method Detail

getAttribute

public Object getAttribute(String name)
Retrieves the value of the attribute with the given name in the scope occurring earliest in the search order. The order is determined by the numeric value of the scope parameter (lowest scope values first.)

Parameters:
name - The name of the the attribute to retrieve.
Returns:
The value of the attribute in the lowest scope for which an attribute with the given name is defined. Returns null if no attribute with the name exists in any scope.

getAttribute

public Object getAttribute(String name,
                           int scope)
Gets the value of an attribute in a given scope.

Parameters:
name - The name of the attribute to retrieve.
scope - The scope in which to retrieve the attribute.
Returns:
The value of the attribute. Returns null is the name does not exist in the given scope.

getAttributesScope

public int getAttributesScope(String name)
Get the lowest scope in which an attribute is defined.

Parameters:
name - Name of the attribute .
Returns:
The lowest scope. Returns -1 if no attribute with the given name is defined in any scope.

getBindings

public Bindings getBindings(int scope)
Returns the value of the engineScope field if specified scope is ENGINE_SCOPE. Returns the value of the globalScope field if the specified scope is GLOBAL_SCOPE.

Parameters:
scope - The specified scope
Returns:
The value of either the engineScope or globalScope field.

getErrorWriter

public Writer getErrorWriter()
{@inheritDoc}


getReader

public Reader getReader()
{@inheritDoc}


getScopes

public List getScopes()
{@inheritDoc}


getWriter

public Writer getWriter()
{@inheritDoc}


removeAttribute

public Object removeAttribute(String name,
                              int scope)
Remove an attribute in a given scope.

Parameters:
name - The name of the attribute to remove
scope - The scope in which to remove the attribute
Returns:
The removed value.

setAttribute

public void setAttribute(String name,
                         Object value,
                         int scope)
Sets the value of an attribute in a given scope.

Parameters:
name - The name of the attribute to set
value - The value of the attribute
scope - The scope in which to set the attribute

setBindings

public void setBindings(Bindings bindings,
                        int scope)
Sets a Bindings of attributes for the given scope. If the value of scope is ENGINE_SCOPE the given Bindings replaces the engineScope field. If the value of scope is GLOBAL_SCOPE the given Bindings replaces the globalScope field.

Parameters:
bindings - The Bindings of attributes to set.
scope - The value of the scope in which the attributes are set.

setErrorWriter

public void setErrorWriter(Writer writer)
{@inheritDoc}

Parameters:
writer

setReader

public void setReader(Reader reader)
{@inheritDoc}

Parameters:
reader

setWriter

public void setWriter(Writer writer)
{@inheritDoc}

Parameters:
writer


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.