public class Eval extends com.sebuilder.interpreter.steptype.Eval implements SRunnerType
TestRun.vars()
into Javascript context
so that the expression like storedVars['variable'] in javascript code will be resolved.
Command | Target | Value |
---|---|---|
store | Edith Wharton | name |
storeEval | storedVars['name'].toUpperCase() | uc |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PARAM_SCRIPT |
Constructor and Description |
---|
Eval() |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.Object |
_eval(com.sebuilder.interpreter.TestRun ctx,
java.lang.String expression)
Evaluate the expression as javascript code.
This method will Remove from the expression the embedding prefix Constants.PARAM_SCRIPT_PREFIX and suffix Constants.PARAM_SCRIPT_SUFFIX if they exist. |
static java.lang.Object |
eval(com.sebuilder.interpreter.TestRun ctx,
java.lang.String expression)
Evaluate the expression if it is javascript code (
isJSExpression(String) return true).Otherwise return the expression as it is. |
java.lang.String |
get(com.sebuilder.interpreter.TestRun ctx) |
protected static boolean |
isJSExpression(java.lang.String possibleExpression) |
protected static java.lang.String |
normalize(java.lang.String expression)
If the expression is enclosed by
Constants.PARAM_SCRIPT_PREFIX and Constants.PARAM_SCRIPT_SUFFIX , they will be removed.Wrap the expression with "return" and ";" to create a javascript code to return result. |
void |
processParams(com.sebuilder.interpreter.Step step,
java.lang.String[] params) |
public static final java.lang.String PARAM_SCRIPT
public java.lang.String get(com.sebuilder.interpreter.TestRun ctx)
get
in interface com.sebuilder.interpreter.Getter
get
in class com.sebuilder.interpreter.steptype.Eval
public void processParams(com.sebuilder.interpreter.Step step, java.lang.String[] params)
processParams
in interface SRunnerType
protected static java.lang.String normalize(java.lang.String expression)
Constants.PARAM_SCRIPT_PREFIX
and Constants.PARAM_SCRIPT_SUFFIX
, they will be removed.expression
- String, javascript expression to evaluate,
it may be enclosed by Constants.PARAM_SCRIPT_PREFIX
and Constants.PARAM_SCRIPT_SUFFIX
protected static boolean isJSExpression(java.lang.String possibleExpression)
possibleExpression
- Stringpublic static java.lang.Object eval(com.sebuilder.interpreter.TestRun ctx, java.lang.String expression)
isJSExpression(String)
return true).ctx
- TestRun, the context within which the expression will be evaluated.expression
- String, the expression to evaluate_eval(TestRun, String)
protected static java.lang.Object _eval(com.sebuilder.interpreter.TestRun ctx, java.lang.String expression)
Constants.PARAM_SCRIPT_PREFIX
and suffix Constants.PARAM_SCRIPT_SUFFIX
if they exist.
TestRun.vars()
).
ctx
- TestRun, the context within which the expression will be evaluated.expression
- String, the expression to evaluatenormalize(String)
,
Utils.executeScript(TestRun, String)
Copyright © SAS Institute. All Rights Reserved.