|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.scripting.bsh.BshScriptUtils
public abstract class BshScriptUtils
Utility methods for handling BeanShell-scripted objects.
Nested Class Summary | |
---|---|
static class |
BshScriptUtils.BshExecutionException
Exception to be thrown on script execution failure. |
private static class |
BshScriptUtils.BshObjectInvocationHandler
InvocationHandler that invokes a BeanShell script method. |
Constructor Summary | |
---|---|
BshScriptUtils()
|
Method Summary | |
---|---|
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. |
(package private) static java.lang.Class |
determineBshObjectType(java.lang.String scriptSource)
Evaluate the specified BeanShell script based on the given script source, returning the Class defined by the script. |
(package private) static java.lang.Object |
evaluateBshScript(java.lang.String scriptSource,
java.lang.Class[] scriptInterfaces,
java.lang.ClassLoader classLoader)
Evaluate the specified BeanShell script based on the given script source, keeping a returned script Class or script Object as-is. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BshScriptUtils()
Method Detail |
---|
public static java.lang.Object createBshObject(java.lang.String scriptSource) throws 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 text
EvalError
- in case of BeanShell parsing failurepublic static java.lang.Object createBshObject(java.lang.String scriptSource, java.lang.Class[] scriptInterfaces) throws 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)
EvalError
- in case of BeanShell parsing failurecreateBshObject(String, Class[], ClassLoader)
public static java.lang.Object createBshObject(java.lang.String scriptSource, java.lang.Class[] scriptInterfaces, java.lang.ClassLoader classLoader) throws 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 create the script proxy with
EvalError
- in case of BeanShell parsing failurestatic java.lang.Class determineBshObjectType(java.lang.String scriptSource) throws EvalError
The script may either declare a full class or return an actual instance of
the scripted object (in which case the Class of the object will be returned).
In any other case, the returned Class will be null
.
scriptSource
- the script source text
null
if none could be determined
EvalError
- in case of BeanShell parsing failurestatic java.lang.Object evaluateBshScript(java.lang.String scriptSource, java.lang.Class[] scriptInterfaces, java.lang.ClassLoader classLoader) throws 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 create the script proxy with
EvalError
- in case of BeanShell parsing failure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |