Class NashornReflectEvaluator
- java.lang.Object
-
- com.intergral.deep.agent.api.plugin.AbstractEvaluator
-
- com.intergral.deep.agent.tracepoint.evaluator.NashornReflectEvaluator
-
- All Implemented Interfaces:
IEvaluator
public class NashornReflectEvaluator extends AbstractEvaluator
This evaluator uses the Nashorn JS engine that is available in some version of Java.This engine was removed in Java 14.
There are limitations of this engine.
1. It can only access public methods/fields 2. It can access 'private' fields only if there is a public getter 3. We have to load this via reflection as we need to load from the app classloader not the boot classloader
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
evaluateExpression(String expression, Map<String,Object> values)
Evaluate an expression to the value.static IEvaluator
loadEvaluator(ClassLoader loader)
Load the evaluator.-
Methods inherited from class com.intergral.deep.agent.api.plugin.AbstractEvaluator
evaluate, objectToBoolean
-
-
-
-
Method Detail
-
loadEvaluator
public static IEvaluator loadEvaluator(ClassLoader loader)
Load the evaluator.- Parameters:
loader
- the class loader to use- Returns:
- the evaluator or
null
if Nashorn is not available.
-
evaluateExpression
public Object evaluateExpression(String expression, Map<String,Object> values) throws Throwable
Description copied from interface:IEvaluator
Evaluate an expression to the value.- Parameters:
expression
- the expression to evaluatevalues
- the variables that the expression can evaluate against- Returns:
- the result of the expression
- Throws:
Throwable
- if the expression fails
-
-