public class DefaultTextSource extends BaseSource implements TextSource
TextSource
interface.
The source ID is "/groovy/script/Script<text-hash>" resp. "/groovy/script/<text-hash>/<desired-class-name>".
The text hash is calculated as follows:
The method BaseSource.getLastModified()
always returns 0.
id
Constructor and Description |
---|
DefaultTextSource(String text)
constructor from script text.
|
DefaultTextSource(String text,
String desiredClassName)
constructor from script text and desired class name.
|
Modifier and Type | Method and Description |
---|---|
String |
getText()
gets the script text.
|
String |
toString()
returns a string suitable for logging.
|
equals, getId, getLastModified, hashCode
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, getId, getLastModified, hashCode
public DefaultTextSource(String text)
If the script text does not explicitly declare a class, the name of the compiled script class will normally be "Script<text-hash>".
text
- script textNullPointerException
- if text is nullpublic DefaultTextSource(String text, String desiredClassName)
If the script text does not explicitly declare a class, the name of the compiled script class will normally be the given desired class name.
text
- script textdesiredClassName
- desired class nameNullPointerException
- if text or desired class name is nullpublic String toString()
Source
toString
in interface Source
toString
in class BaseSource
public String getText()
TextSource
getText
in interface TextSource