Package io.engineblock.scripting
Class NashornEvaluator<T>
- java.lang.Object
-
- io.engineblock.scripting.NashornEvaluator<T>
-
-
Constructor Summary
Constructors Constructor Description NashornEvaluator(java.lang.Class<? extends T> resultType, java.lang.Object... vars)Create a new NashornEvaluator.
-
Method Summary
Modifier and Type Method Description Teval()Evaluate the compiled script if it is compiled, or the raw script text otherwise.NashornEvaluator<T>put(java.lang.String varName, java.lang.Object var)Put a varianble into the script environmentNashornEvaluator<T>script(java.lang.String scriptText)Set the script that will be evaluated.
-
-
-
Constructor Detail
-
NashornEvaluator
public NashornEvaluator(java.lang.Class<? extends T> resultType, java.lang.Object... vars)
Create a new NashornEvaluator.- Parameters:
resultType- The required class of the result type, which must extend generic parameter type t.vars- Optional pairs of names and values. vars[0] is a name, vars[1] is a value, ...
-
-
Method Detail
-
script
public NashornEvaluator<T> script(java.lang.String scriptText)
Set the script that will be evaluated.
-
eval
public T eval()
Evaluate the compiled script if it is compiled, or the raw script text otherwise. It is not an error to call this without setting the script to something other than the default of "", but it not very useful in most cases.
-
put
public NashornEvaluator<T> put(java.lang.String varName, java.lang.Object var)
Put a varianble into the script environment
-
-