public class StaticScriptSource extends java.lang.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(java.lang.String script)
Create a new StaticScriptSource for the given script.
|
StaticScriptSource(java.lang.String script,
java.lang.String className)
Create a new StaticScriptSource for the given script.
|
Modifier and Type | Method and Description |
---|---|
java.lang.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(java.lang.String script)
Set a fresh script String, overriding the previous script.
|
java.lang.String |
suggestedClassName()
Determine a class name for the underlying script.
|
java.lang.String |
toString() |
public StaticScriptSource(java.lang.String script)
script
- the script Stringpublic StaticScriptSource(java.lang.String script, @Nullable java.lang.String className)
script
- the script StringclassName
- the suggested class name for the script
(may be null
)public void setScript(java.lang.String script)
script
- the script Stringpublic java.lang.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 java.lang.String suggestedClassName()
ScriptSource
suggestedClassName
in interface ScriptSource
null
if none availablepublic java.lang.String toString()
toString
in class java.lang.Object