public abstract class GString extends GroovyObjectSupport implements java.lang.Comparable, java.lang.CharSequence, Writable, Buildable, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static GString |
EMPTY
A GString containing a single empty String and no values.
|
static java.lang.Object[] |
EMPTY_OBJECT_ARRAY |
static java.lang.String[] |
EMPTY_STRING_ARRAY |
| Constructor and Description |
|---|
GString(java.lang.Object values) |
GString(java.lang.Object[] values) |
| Modifier and Type | Method and Description |
|---|---|
void |
build(GroovyObject builder) |
char |
charAt(int index) |
int |
compareTo(java.lang.Object that) |
boolean |
equals(GString that) |
boolean |
equals(java.lang.Object that) |
byte[] |
getBytes() |
byte[] |
getBytes(java.lang.String charset) |
abstract java.lang.String[] |
getStrings() |
java.lang.Object |
getValue(int idx) |
int |
getValueCount() |
java.lang.Object[] |
getValues() |
int |
hashCode() |
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object args)
Overloaded to implement duck typing for Strings
so that any method that can't be evaluated on this
object will be forwarded to the toString() object instead.
|
int |
length() |
java.util.regex.Pattern |
negate()
Turns a String into a regular expression pattern
|
GString |
plus(GString that) |
GString |
plus(java.lang.String that) |
java.lang.CharSequence |
subSequence(int start,
int end) |
java.lang.String |
toString() |
java.io.Writer |
writeTo(java.io.Writer out)
Writes this object to the given writer.
|
getMetaClass, getProperty, setMetaClass, setPropertypublic static final java.lang.String[] EMPTY_STRING_ARRAY
public static final java.lang.Object[] EMPTY_OBJECT_ARRAY
public static final GString EMPTY
public GString(java.lang.Object values)
public GString(java.lang.Object[] values)
public abstract java.lang.String[] getStrings()
public java.lang.Object invokeMethod(java.lang.String name,
java.lang.Object args)
invokeMethod in interface GroovyObjectinvokeMethod in class GroovyObjectSupportname - the name of the method to callargs - the arguments to use for the method callpublic java.lang.Object[] getValues()
public GString plus(java.lang.String that)
public int getValueCount()
public java.lang.Object getValue(int idx)
public java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic java.io.Writer writeTo(java.io.Writer out)
throws java.io.IOException
WritableThis is used to defer content creation until the point when it is streamed to the output destination. Oftentimes, content will be defined but not necessarily created (as is may be the case with a Closure definition.) In that case, the output is then 'deferred' to the point when it is serialized to the writer. This class may be used whenever an object should be responsible for creating its own textual representation, but creating the entire output as a single String would be inefficient (such as outputting a multi-gigabyte XML document.)
public void build(GroovyObject builder)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object that)
equals in class java.lang.Objectpublic boolean equals(GString that)
public int compareTo(java.lang.Object that)
compareTo in interface java.lang.Comparablepublic char charAt(int index)
charAt in interface java.lang.CharSequencepublic int length()
length in interface java.lang.CharSequencepublic java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencepublic java.util.regex.Pattern negate()
public byte[] getBytes()
public byte[] getBytes(java.lang.String charset)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException