Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.scxml
Interface Context

All Known Implementing Classes:
  SimpleContext

public interface Context

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

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

Method Detail

### set

    public void set(String name,
                    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

    public void setLocal(String name,
                         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

    public Object get(String name)

  Get the value of this variable; delegating to parent.

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

### has

    public boolean has(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

    public 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

    public void reset()

  Clear this Context.

### getParent

    public Context getParent()

  Get the parent Context, may be null.

  Returns:
    The parent Context in a chained Context environment

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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