T - The return type that is needed by the callerpublic interface Evaluator<T>
An evaluator is a scripting helper that knows what its return type will be at runtime. You can create an Evaluator from an environment and a desired return type, then reuse it. Primitive types that can be mapped from the script to the return type should, including
An evaluator is not threadsafe by default. If you need threadsafe evaluators with similar semantics, wrap it in a ThreadLocal.
| Modifier and Type | Method and Description |
|---|---|
T |
eval()
Evaluate the provided script, returning the value that it yields
|
NashornEvaluator<T> |
put(String varName,
Object var)
Set the variable environment of the evaluator
|
NashornEvaluator<T> |
script(String scriptText) |
T eval()
NashornEvaluator<T> script(String scriptText)
scriptText - Nashorn compatible script textNashornEvaluator<T> put(String varName, Object var)
varName - the variable name to add to the environmentvar - the object to bind to the varnameCopyright © 2017. All rights reserved.