public class StaticScriptSource extends Object implements ScriptSource
ScriptSource
interface,
encapsulating a given String that contains the script source text.
Supports programmatic updates of the script String.Constructor and Description |
---|
StaticScriptSource(String script)
Create a new StaticScriptSource for the given script.
|
StaticScriptSource(String script,
String className)
Create a new StaticScriptSource for the given script.
|
Modifier and Type | Method and Description |
---|---|
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. |
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() |
public StaticScriptSource(String script)
script
- the script Stringpublic void setScript(String script)
script
- the script Stringpublic String getScriptAsString()
ScriptSource
getScriptAsString
in interface ScriptSource
public boolean isModified()
ScriptSource
ScriptSource.getScriptAsString()
was called.
Returns true
if the script has not been read yet.isModified
in interface ScriptSource
@Nullable public String suggestedClassName()
ScriptSource
suggestedClassName
in interface ScriptSource
null
if none available