public interface ScriptFactory
Object
.getScriptSourceLocator()
,
getScriptedObject(org.springframework.scripting.ScriptSource, java.lang.Class<?>...)
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getScriptedObject(ScriptSource scriptSource,
java.lang.Class<?>... actualInterfaces)
Factory method for creating the scripted Java object.
|
java.lang.Class<?> |
getScriptedObjectType(ScriptSource scriptSource)
Determine the type of the scripted Java object.
|
java.lang.Class<?>[] |
getScriptInterfaces()
Return the business interfaces that the script is supposed to implement.
|
java.lang.String |
getScriptSourceLocator()
Return a locator that points to the source of the script.
|
boolean |
requiresConfigInterface()
Return whether the script requires a config interface to be
generated for it.
|
boolean |
requiresScriptedObjectRefresh(ScriptSource scriptSource)
Determine whether a refresh is required (e.g.
|
java.lang.String getScriptSourceLocator()
Typical supported locators are Spring resource locations (such as "file:C:/myScript.bsh" or "classpath:myPackage/myScript.bsh") and inline scripts ("inline:myScriptText...").
ScriptFactoryPostProcessor.convertToScriptSource(java.lang.String, java.lang.String, org.springframework.core.io.ResourceLoader)
,
ResourceLoader
@Nullable java.lang.Class<?>[] getScriptInterfaces()
Can return null
if the script itself determines
its Java interfaces (such as in the case of Groovy).
boolean requiresConfigInterface()
getScriptInterfaces()
.getScriptInterfaces()
@Nullable java.lang.Object getScriptedObject(ScriptSource scriptSource, @Nullable java.lang.Class<?>... actualInterfaces) throws java.io.IOException, ScriptCompilationException
Implementations are encouraged to cache script metadata such as a generated script class. Note that this method may be invoked concurrently and must be implemented in a thread-safe fashion.
scriptSource
- the actual ScriptSource to retrieve
the script source text from (never null
)actualInterfaces
- the actual interfaces to expose,
including script interfaces as well as a generated config interface
(if applicable; may be null
)java.io.IOException
- if script retrieval failedScriptCompilationException
- if script compilation failed@Nullable java.lang.Class<?> getScriptedObjectType(ScriptSource scriptSource) throws java.io.IOException, ScriptCompilationException
Implementations are encouraged to cache script metadata such as a generated script class. Note that this method may be invoked concurrently and must be implemented in a thread-safe fashion.
scriptSource
- the actual ScriptSource to retrieve
the script source text from (never null
)null
if none could be determinedjava.io.IOException
- if script retrieval failedScriptCompilationException
- if script compilation failedboolean requiresScriptedObjectRefresh(ScriptSource scriptSource)
isModified()
method).scriptSource
- the actual ScriptSource to retrieve
the script source text from (never null
)getScriptedObject(org.springframework.scripting.ScriptSource, java.lang.Class<?>...)
call is requiredScriptSource.isModified()