public abstract class BshScriptUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BshScriptUtils.BshExecutionException
Exception to be thrown on script execution failure.
|
Constructor and Description |
---|
BshScriptUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
createBshObject(java.lang.String scriptSource)
Create a new BeanShell-scripted object from the given script source.
|
static java.lang.Object |
createBshObject(java.lang.String scriptSource,
java.lang.Class<?>... scriptInterfaces)
Create a new BeanShell-scripted object from the given script source,
using the default ClassLoader.
|
static java.lang.Object |
createBshObject(java.lang.String scriptSource,
java.lang.Class<?>[] scriptInterfaces,
java.lang.ClassLoader classLoader)
Create a new BeanShell-scripted object from the given script source.
|
public static java.lang.Object createBshObject(java.lang.String scriptSource) throws bsh.EvalError
With this createBshObject
variant, the script needs to
declare a full class or return an actual instance of the scripted object.
scriptSource
- the script source textbsh.EvalError
- in case of BeanShell parsing failurepublic static java.lang.Object createBshObject(java.lang.String scriptSource, @Nullable java.lang.Class<?>... scriptInterfaces) throws bsh.EvalError
The script may either be a simple script that needs a corresponding proxy generated (implementing the specified interfaces), or declare a full class or return an actual instance of the scripted object (in which case the specified interfaces, if any, need to be implemented by that class/instance).
scriptSource
- the script source textscriptInterfaces
- the interfaces that the scripted Java object is
supposed to implement (may be null
or empty if the script itself
declares a full class or returns an actual instance of the scripted object)bsh.EvalError
- in case of BeanShell parsing failurecreateBshObject(String, Class[], ClassLoader)
public static java.lang.Object createBshObject(java.lang.String scriptSource, @Nullable java.lang.Class<?>[] scriptInterfaces, @Nullable java.lang.ClassLoader classLoader) throws bsh.EvalError
The script may either be a simple script that needs a corresponding proxy generated (implementing the specified interfaces), or declare a full class or return an actual instance of the scripted object (in which case the specified interfaces, if any, need to be implemented by that class/instance).
scriptSource
- the script source textscriptInterfaces
- the interfaces that the scripted Java object is
supposed to implement (may be null
or empty if the script itself
declares a full class or returns an actual instance of the scripted object)classLoader
- the ClassLoader to use for evaluating the scriptbsh.EvalError
- in case of BeanShell parsing failure