|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.scripting.support.ResourceScriptSource
public class ResourceScriptSource
ScriptSource
implementation
based on Spring's Resource
abstraction. Loads the script text from the underlying Resource's
File
or
InputStream
,
and tracks the last-modified timestamp of the file (if possible).
InputStreamSource.getInputStream()
,
Resource.getFile()
,
ResourceLoader
Field Summary | |
---|---|
protected Log |
logger
Logger available to subclasses |
Constructor Summary | |
---|---|
ResourceScriptSource(Resource resource)
Create a new ResourceScriptSource for the given resource. |
Method Summary | |
---|---|
Resource |
getResource()
Return the Resource to load the
script from. |
String |
getScriptAsString()
Retrieve the current script source text as String. |
boolean |
isModified()
Indicate whether the underlying script data has been modified since the last time ScriptSource.getScriptAsString() was called. |
protected long |
retrieveLastModifiedTime()
Retrieve the current last-modified timestamp of the underlying resource. |
String |
suggestedClassName()
Determine a class name for the underlying script. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Log logger
Constructor Detail |
---|
public ResourceScriptSource(Resource resource)
resource
- the Resource to load the script fromMethod Detail |
---|
public final Resource getResource()
Resource
to load the
script from.
public String getScriptAsString() throws IOException
ScriptSource
getScriptAsString
in interface ScriptSource
IOException
- if script retrieval failedpublic boolean isModified()
ScriptSource
ScriptSource.getScriptAsString()
was called.
Returns true
if the script has not been read yet.
isModified
in interface ScriptSource
protected long retrieveLastModifiedTime()
public String suggestedClassName()
ScriptSource
suggestedClassName
in interface ScriptSource
null
if none availablepublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |