org.specrunner.expressions.core
Class ExpressionVariable

java.lang.Object
  extended by org.specrunner.expressions.core.AbstractExpression
      extended by org.specrunner.expressions.core.ExpressionVariable
All Implemented Interfaces:
IExpression

public class ExpressionVariable
extends AbstractExpression

Expression variable. Lookup by variable name in the context using getByName(<name>) method.

Author:
Thiago Santos

Field Summary
protected  String name
          The variable name.
 
Fields inherited from class org.specrunner.expressions.core.AbstractExpression
DEFAULT_PRECEDENCE
 
Fields inherited from interface org.specrunner.expressions.IExpression
FEATURE_PRECEDENCE
 
Constructor Summary
ExpressionVariable(IExpressionFactory parent, String name)
          Creates an expression to access a variable.
 
Method Summary
 Object evaluate(IContext context, boolean silent)
          Given a context, evaluates the expression.
 String getName()
          Gets the variable name.
 void setName(String name)
          Sets the variable name.
 
Methods inherited from class org.specrunner.expressions.core.AbstractExpression
evaluate, getParent, getPrecedence, setPrecedence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name
The variable name.

Constructor Detail

ExpressionVariable

public ExpressionVariable(IExpressionFactory parent,
                          String name)
Creates an expression to access a variable.

Parameters:
parent - The expression factory.
name - The variable name.
Method Detail

getName

public String getName()
Gets the variable name.

Returns:
The name.

setName

public void setName(String name)
Sets the variable name.

Parameters:
name - The name.

evaluate

public Object evaluate(IContext context,
                       boolean silent)
                throws ExpressionException
Description copied from interface: IExpression
Given a context, evaluates the expression.

Parameters:
context - A contextual information.
silent - true, for evaluation without exceptions, false, otherwise.
Returns:
The result of expression evaluation.
Throws:
ExpressionException - On evaluation errors.


Copyright © 2014. All rights reserved.