Top Description Fields Constructors Methods
org.springframework.scripting.support

public Class StaticScriptSource

extends Object
implements ScriptSource
Class Inheritance
All Implemented Interfaces
org.springframework.scripting.ScriptSource
Imports
org.springframework.lang.Nullable, org.springframework.scripting.ScriptSource, org.springframework.util.Assert

Static implementation of the org.springframework.scripting.ScriptSource interface, encapsulating a given String that contains the script source text. Supports programmatic updates of the script String.
Authors
Rob Harrop, Juergen Hoeller
Since
2.0

Field Summary

Modifier and TypeField and Description
private String
private boolean
private String

Constructor Summary

AccessConstructor and Description
public
StaticScriptSource(String
the script String
script
)

Create a new StaticScriptSource for the given script.

public
StaticScriptSource(String
the script String
script
,
String
the suggested class name for the script (may be null)
className
)

Create a new StaticScriptSource for the given script.

Method Summary

Modifier and TypeMethod and Description
public synchronized String
getScriptAsString()

Implements org.springframework.scripting.ScriptSource.getScriptAsString.

Retrieve the current script source text as String.

public synchronized boolean
isModified()

Implements org.springframework.scripting.ScriptSource.isModified.

Indicate whether the underlying script data has been modified since the last time getScriptAsString() was called.

public synchronized void
setScript(String
the script String
script
)

Set a fresh script String, overriding the previous script.

public String
suggestedClassName()

Implements org.springframework.scripting.ScriptSource.suggestedClassName.

Determine a class name for the underlying script.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

classNameback to summary
private String className
Annotations
@Nullable
modifiedback to summary
private boolean modified
scriptback to summary
private String script

Constructor Detail

StaticScriptSourceback to summary
public StaticScriptSource(String script)

Create a new StaticScriptSource for the given script.

Parameters
script:String

the script String

StaticScriptSourceback to summary
public StaticScriptSource(String script, String className)

Create a new StaticScriptSource for the given script.

Parameters
script:String

the script String

className:String

the suggested class name for the script (may be null)

Method Detail

getScriptAsStringback to summary
public synchronized String getScriptAsString()

Implements org.springframework.scripting.ScriptSource.getScriptAsString.

Doc from org.springframework.scripting.ScriptSource.getScriptAsString.

Retrieve the current script source text as String.

Returns:String

the script text

Annotations
@Override
isModifiedback to summary
public synchronized boolean isModified()

Implements org.springframework.scripting.ScriptSource.isModified.

Doc from org.springframework.scripting.ScriptSource.isModified.

Indicate whether the underlying script data has been modified since the last time getScriptAsString() was called. Returns true if the script has not been read yet.

Returns:boolean

whether the script data has been modified

Annotations
@Override
setScriptback to summary
public synchronized void setScript(String script)

Set a fresh script String, overriding the previous script.

Parameters
script:String

the script String

suggestedClassNameback to summary
public String suggestedClassName()

Implements org.springframework.scripting.ScriptSource.suggestedClassName.

Doc from org.springframework.scripting.ScriptSource.suggestedClassName.

Determine a class name for the underlying script.

Returns:String

the suggested class name, or null if none available

Annotations
@Override
@Nullable
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override