org.specrunner.util.expression
Class UtilExpression

java.lang.Object
  extended by org.specrunner.util.expression.UtilExpression

public final class UtilExpression
extends Object

Utility class for expressions.

Author:
Thiago Santos

Method Summary
static String asExpression(String content)
          Given a content, surround it with the expression mark.
static Object evaluate(String text, IContext context, boolean silent)
          Evaluates the text and returns an object.
static String replace(String text, IContext context, boolean silent)
          Replace placeholders in text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asExpression

public static String asExpression(String content)
Given a content, surround it with the expression mark.

Parameters:
content - The content to become an expression.
Returns:
The corresponding expression block.

evaluate

public static Object evaluate(String text,
                              IContext context,
                              boolean silent)
                       throws PluginException
Evaluates the text and returns an object.

Parameters:
text - The text expression.
context - A context.
silent - To evaluate expressions silently.
Returns:
The result.
Throws:
PluginException - On evaluation errors.

replace

public static String replace(String text,
                             IContext context,
                             boolean silent)
                      throws PluginException
Replace placeholders in text.

Parameters:
text - The text to be replaced.
context - A context.
silent - To evaluate expressions silently.
Returns:
The replaced text.
Throws:
PluginException - On replacing errors.


Copyright © 2015. All rights reserved.