public class JavascriptWrapper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JavascriptWrapper.JsResponse
Wrapper class for Response to be embedded in the Rhino Context.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
JSON_OBJ_NAME
the name of the JS object containing the json body:
jsonbody. |
static String |
RESPONSE_OBJ_NAME
the name of the JS object containig the http response:
response. |
static String |
SYMBOLS_OBJ_NAME
the name of the JS object containing the symbol table:
symbols. |
static String |
THRESHOLD_PROP_NAME |
| Constructor and Description |
|---|
JavascriptWrapper(RunnerVariablesProvider variablesProvider,
Config config) |
| Modifier and Type | Method and Description |
|---|---|
Object |
evaluateExpression(smartrics.rest.client.RestResponse response,
String expression)
evaluates a Javascript expression in the given
RestResponse. |
Object |
evaluateExpression(smartrics.rest.client.RestResponse response,
String expression,
Map<String,String> imports) |
Object |
evaluateExpression(String json,
String expression)
evaluates an expression on a given json object represented as string.
|
Object |
evaluateExpression(String json,
String expression,
Map<String,String> imports) |
boolean |
looksLikeAJsExpression(String json) |
public static final String RESPONSE_OBJ_NAME
response.public static final String SYMBOLS_OBJ_NAME
symbols.public static final String JSON_OBJ_NAME
jsonbody.public static final String THRESHOLD_PROP_NAME
public JavascriptWrapper(RunnerVariablesProvider variablesProvider, Config config)
public Object evaluateExpression(smartrics.rest.client.RestResponse response, String expression)
RestResponse.response - the RestResponseexpression - the javascript expressionpublic Object evaluateExpression(smartrics.rest.client.RestResponse response, String expression, Map<String,String> imports)
public Object evaluateExpression(String json, String expression)
json - the json object.expression - the expression.public Object evaluateExpression(String json, String expression, Map<String,String> imports)
public boolean looksLikeAJsExpression(String json)
json - the potential json string. loosely checks if the input string contains JSON_OBJ_NAME.Copyright © 2017 smartrics. All rights reserved.