org.apache.commons.scxml
Interface Context

All Known Implementing Classes:
ELContext, JexlContext, RootContext, SessionContext, SimpleContext

public interface Context

A Context or "scope" for storing variables; usually tied to a SCXML root or State object.


Method Summary
 java.lang.Object get(java.lang.String name)
          Get the value of this variable; delegating to parent.
 Context getParent()
          Get the parent Context, may be null.
 java.util.Map getVars()
          Get the Map of all variables in this Context.
 boolean has(java.lang.String name)
          Check if this variable exists, delegating to parent.
 void reset()
          Clear this Context.
 void set(java.lang.String name, java.lang.Object value)
          Assigns a new value to an existing variable or creates a new one.
 void setLocal(java.lang.String name, java.lang.Object value)
          Assigns a new value to an existing variable or creates a new one.
 

Method Detail

set

void set(java.lang.String name,
         java.lang.Object value)
Assigns a new value to an existing variable or creates a new one. The method searches the chain of parent Contexts for variable existence.

Parameters:
name - The variable name
value - The variable value

setLocal

void setLocal(java.lang.String name,
              java.lang.Object value)
Assigns a new value to an existing variable or creates a new one. The method allows to shaddow a variable of the same name up the Context chain.

Parameters:
name - The variable name
value - The variable value

get

java.lang.Object get(java.lang.String name)
Get the value of this variable; delegating to parent.

Parameters:
name - The name of the variable
Returns:
The value (or null)

has

boolean has(java.lang.String name)
Check if this variable exists, delegating to parent.

Parameters:
name - The name of the variable
Returns:
Whether a variable with the name exists in this Context

getVars

java.util.Map getVars()
Get the Map of all variables in this Context.

Returns:
Local variable entries Map To get variables in parent Context, call getParent().getVars().
See Also:
getParent()

reset

void reset()
Clear this Context.


getParent

Context getParent()
Get the parent Context, may be null.

Returns:
The parent Context in a chained Context environment


Copyright © 2005-2008 The Apache Software Foundation. All Rights Reserved.