public class MultipleGroovyScriptFactory extends Object implements org.springframework.context.ApplicationContextAware, ScriptFactory<groovy.lang.GroovyObject>
GroovyScriptFactory
Constructor and Description |
---|
MultipleGroovyScriptFactory() |
Modifier and Type | Method and Description |
---|---|
Object |
executeMethod(groovy.lang.GroovyObject adapter,
String methodName,
Object... args)
Execute Native script by default given method Name
|
protected Object |
executeScript(org.springframework.scripting.ScriptSource scriptSource,
Class scriptClass)
Instantiate the given Groovy script class and run it if necessary.
|
groovy.lang.GroovyClassLoader |
getGroovyClassLoader()
Return the GroovyClassLoader used by this script factory.
|
Object |
getScriptedObject(org.springframework.scripting.ScriptSource scriptSource,
File scriptFromFile,
Class[] actualInterfaces,
Map<String,Object> injectedParams)
Loads and parses the Groovy script via the GroovyClassLoader and provide it Spring Context.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext context) |
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
public void setApplicationContext(org.springframework.context.ApplicationContext context) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public groovy.lang.GroovyClassLoader getGroovyClassLoader()
public Object getScriptedObject(org.springframework.scripting.ScriptSource scriptSource, File scriptFromFile, Class[] actualInterfaces, Map<String,Object> injectedParams) throws IOException, org.springframework.scripting.ScriptCompilationException
GroovyShell
with the following input bindings:
getScriptedObject
in interface ScriptFactory<groovy.lang.GroovyObject>
ScriptSource
- scriptFromFile
- as InputStream
as the Script to be compiled - Can be from a File or ScriptSource.getScriptAsString()
.. see GroovyClassLoader#parseClass(...)
options @nullable true (Optional).
if not specified then ScriptSource.getScriptAsString()
will be used. This is supplied as ScriptSource.getScriptAsString()
may not execute from all types of ResourcesactualInterfaces
- as Class[] @nullable trueinjectedParams
- as Params to inject into the created script instance @nullable trueGroovyObject
,
or the result of running the script instance as any object)IOException
org.springframework.scripting.ScriptCompilationException
GroovyClassLoader
protected Object executeScript(org.springframework.scripting.ScriptSource scriptSource, Class scriptClass) throws org.springframework.scripting.ScriptCompilationException
scriptSource
- the source for the underlying scriptscriptClass
- the Groovy script classGroovyObject
,
or the result of running the script instance as any object)org.springframework.scripting.ScriptCompilationException
- in case of instantiation failurepublic Object executeMethod(groovy.lang.GroovyObject adapter, String methodName, Object... args) throws Exception
ScriptFactory
executeMethod
in interface ScriptFactory<groovy.lang.GroovyObject>
methodName
- as Stringargs
- as Object[]Exception
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
org.springframework.beans.BeansException
public void setBeanClassLoader(ClassLoader classLoader)
Copyright © 2018. All rights reserved.