org.apache.commons.betwixt.expression
Class VariableExpression

java.lang.Object
  extended by org.apache.commons.betwixt.expression.VariableExpression
All Implemented Interfaces:
Expression

public class VariableExpression
extends java.lang.Object
implements Expression

VariableExpression represents a variable expression such as $foo which returns the value of the given variable.

Version:
$Revision: 438373 $
Author:
James Strachan

Constructor Summary
VariableExpression()
          Base constructor
VariableExpression(java.lang.String variableName)
          Convenience constructor sets VariableName property
 
Method Summary
 java.lang.Object evaluate(Context context)
          Return the value of a context variable.
 java.lang.String getVariableName()
          Gets the variable name
 void setVariableName(java.lang.String variableName)
          Sets the variable name
 java.lang.String toString()
          Returns something useful for logging
 void update(Context context, java.lang.String newValue)
          Do nothing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableExpression

public VariableExpression()
Base constructor


VariableExpression

public VariableExpression(java.lang.String variableName)
Convenience constructor sets VariableName property

Parameters:
variableName - the name of the context variable whose value will be returned by an evaluation
Method Detail

evaluate

public java.lang.Object evaluate(Context context)
Return the value of a context variable.

Specified by:
evaluate in interface Expression
Parameters:
context - evaluate against this context
Returns:
the value of the context variable named by the VariableName property

getVariableName

public java.lang.String getVariableName()
Gets the variable name

Returns:
the name of the context variable whose value will be returned by an evaluation

setVariableName

public void setVariableName(java.lang.String variableName)
Sets the variable name

Parameters:
variableName - the name of the context variable whose value will be returned by an evaluation

update

public void update(Context context,
                   java.lang.String newValue)
Do nothing

Specified by:
update in interface Expression
Parameters:
context - update this Context
newValue - the new value for this expression
See Also:
Expression

toString

public java.lang.String toString()
Returns something useful for logging

Overrides:
toString in class java.lang.Object
Returns:
something useful for logging


Copyright 2002-2008 The Apache Software Foundation. All Rights Reserved.