public class ScriptEvaluator<T> extends Object
Compilation is done in main memory, i.e. without writing to the filesystem.
The result is an object that can be executed (and reused) any number of times. This is a high
performance implementation, using an optimized variant of https://scripting.dev.java.net/" (JSR
223 Java Scripting). Calling evaluate(Object...)
just means calling
Method.invoke(Object, Object...)
and as such has the same minimal runtime cost, i.e.
O(100M calls/sec/core).
Instances of this class are thread-safe if the user provided script statements are thread-safe.
Constructor and Description |
---|
ScriptEvaluator(String javaImports,
String javaCodeBlock,
Class<T> returnType,
String[] parameterNames,
Class[] parameterTypes,
Class[] throwTypes,
String parseLocation) |
ScriptEvaluator(String javaImports,
String javaCodeBlock,
Class<T> returnType,
String[] parameterNames,
Class[] parameterTypes,
String parseLocation) |
public ScriptEvaluator(String javaImports, String javaCodeBlock, Class<T> returnType, String[] parameterNames, Class[] parameterTypes, String parseLocation) throws ScriptException
ScriptException
public ScriptEvaluator(String javaImports, String javaCodeBlock, Class<T> returnType, String[] parameterNames, Class[] parameterTypes, Class[] throwTypes, String parseLocation) throws ScriptException
ScriptException
public T evaluate(Object... params) throws ScriptException
ScriptException
Copyright © 2013–2015. All rights reserved.