public class

StaticScriptSource

extends Object
implements ScriptSource
java.lang.Object
   ↳ org.springframework.scripting.support.StaticScriptSource

Class Overview

Static implementation of the ScriptSource interface, encapsulating a given String that contains the script source text. Supports programmatic updates of the script String.

Summary

Public Constructors
StaticScriptSource(String script)
Create a new StaticScriptSource for the given script.
StaticScriptSource(String script, String className)
Create a new StaticScriptSource for the given script.
Public Methods
synchronized String getScriptAsString()
Retrieve the current script source text as String.
synchronized boolean isModified()
Indicate whether the underlying script data has been modified since the last time getScriptAsString() was called.
synchronized void setScript(String script)
Set a fresh script String, overriding the previous script.
String suggestedClassName()
Determine a class name for the underlying script.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.scripting.ScriptSource

Public Constructors

public StaticScriptSource (String script)

Create a new StaticScriptSource for the given script.

Parameters
script the script String

public StaticScriptSource (String script, String className)

Create a new StaticScriptSource for the given script.

Parameters
script the script String
className the suggested class name for the script (may be null)

Public Methods

public synchronized String getScriptAsString ()

Retrieve the current script source text as String.

Returns
  • the script text

public synchronized boolean 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
  • whether the script data has been modified

public synchronized void setScript (String script)

Set a fresh script String, overriding the previous script.

Parameters
script the script String

public String suggestedClassName ()

Determine a class name for the underlying script.

Returns
  • the suggested class name, or null if none available

public String toString ()