org.specrunner.util
Class UtilEvaluator

java.lang.Object
  extended by org.specrunner.util.UtilEvaluator

public final class UtilEvaluator
extends Object

Utility class for expressions.

Author:
Thiago Santos

Field Summary
static String END
          End code delimiter.
static char ESCAPE
          Escape mark.
static String START_CODE
          Start code delimiter.
static String START_DATA
          Start code replacement.
 
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 ids in text.
static String replace(String text, String name, Object local)
          Replace the same string which appear many times in text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ESCAPE

public static final char ESCAPE
Escape mark.

See Also:
Constant Field Values

START_CODE

public static final String START_CODE
Start code delimiter.

See Also:
Constant Field Values

END

public static final String END
End code delimiter.

See Also:
Constant Field Values

START_DATA

public static final String START_DATA
Start code replacement.

See Also:
Constant Field Values
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 ids 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.

replace

public static String replace(String text,
                             String name,
                             Object local)
Replace the same string which appear many times in text.

Parameters:
text - The text to be replaced.
name - The name.
local - The replacing value.
Returns:
The replaced string.


Copyright © 2014. All rights reserved.