public abstract class GString extends GroovyObjectSupport implements Buildable, Comparable, CharSequence, Writable, Serializable
Represents a String which contains embedded values such as "hello there ${user} how are you?" which can be evaluated lazily. Advanced users can iterate over the text and values to perform special processing, such as for performing SQL operations, the values can be substituted for ? and the actual value objects can be bound to a JDBC statement.
James Strachan: The lovely name of this class was suggested by Jules Gosnell and was such a good idea, I couldn't resist :)
Modifiers | Name | Description |
---|---|---|
static GString |
EMPTY |
A GString containing a single empty String and no values. |
static Object[] |
EMPTY_OBJECT_ARRAY |
|
static String[] |
EMPTY_STRING_ARRAY |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
build(GroovyObject builder) |
|
char |
charAt(int index) |
|
int |
compareTo(Object that) |
|
boolean |
equals(Object that) |
|
boolean |
equals(GString that) |
|
byte[] |
getBytes() |
|
byte[] |
getBytes(String charset) |
|
String[] |
getStrings() |
|
String[] |
getStrings() |
|
Object |
getValue(int idx) |
|
int |
getValueCount() |
|
Object[] |
getValues() |
|
int |
hashCode() |
|
Object |
invokeMethod(String name, 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() |
|
Pattern |
negate() Turns a String into a regular expression pattern |
|
GString |
plus(GString that) |
|
GString |
plus(String that) |
|
CharSequence |
subSequence(int start, int end) |
|
String |
toString() |
|
String |
toString() |
|
Writer |
writeTo(Writer out) |
Methods inherited from class | Name |
---|---|
class GroovyObjectSupport |
getMetaClass, setMetaClass |
A GString containing a single empty String and no values.
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.
Turns a String into a regular expression pattern
Copyright © 2003-2020 The Apache Software Foundation. All rights reserved.