net.christopherschultz.evaluator.util
Class ChainedEvaluationContext

java.lang.Object
  extended by net.christopherschultz.evaluator.util.DefaultEvaluationContext
      extended by net.christopherschultz.evaluator.util.ChainedEvaluationContext
All Implemented Interfaces:
EvaluationContext

public class ChainedEvaluationContext
extends DefaultEvaluationContext

Provides a wrapper around another EvaluationContext.

This is useful when you want to have a shared, global set of functions and values, but also want to have some functions and values local to one EvaluationContext.

This class provides read-only access to the parent EvaluationContext, and searches the local environment before searching the parent.

Version:
$Revision: 1.6 $ $Date: 2008-06-20 22:58:48 $
Author:
Chris Schultz

Constructor Summary
ChainedEvaluationContext(EvaluationContext parent)
          Creates a new ChainedEvaluationContext.
 
Method Summary
 Object get(String identifier)
          Gets the value of the specified identifier.
 Map getAll()
          Returns a Map of all bound identifiers and their values.
 
Methods inherited from class net.christopherschultz.evaluator.util.DefaultEvaluationContext
getProperty, load, load, loadStandard, remove, removeProperty, set, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainedEvaluationContext

public ChainedEvaluationContext(EvaluationContext parent)
Creates a new ChainedEvaluationContext.

Parameters:
parent - The parent EvaluationContext.
Method Detail

get

public Object get(String identifier)
Gets the value of the specified identifier.

Specified by:
get in interface EvaluationContext
Overrides:
get in class DefaultEvaluationContext
Parameters:
identifier - The identifier for the value.
Returns:
The value of the specified value.

getAll

public Map getAll()
Description copied from class: DefaultEvaluationContext
Returns a Map of all bound identifiers and their values. The Map is not modifiable.

Specified by:
getAll in interface EvaluationContext
Overrides:
getAll in class DefaultEvaluationContext
Returns:
A Map of all identifiers as keys and their values as the values of the Map.