|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.lang.GString
public abstract class GString
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. The lovely name of this class was suggested by Jules Gosnell and was such a good idea, I couldn't resist :)
Field Summary | |
---|---|
static GString |
EMPTY
A GString containing a single empty String and no values. |
Constructor Summary | |
---|---|
GString(Object values)
|
|
GString(Object[] values)
|
Method Summary | |
---|---|
void |
build(GroovyObject builder)
|
char |
charAt(int index)
|
int |
compareTo(Object that)
|
boolean |
equals(GString that)
|
boolean |
equals(Object that)
|
abstract 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()
|
Writer |
writeTo(Writer out)
Writes this object to the given writer. |
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, getProperty, setMetaClass, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final GString EMPTY
Constructor Detail |
---|
public GString(Object values)
public GString(Object[] values)
Method Detail |
---|
public abstract String[] getStrings()
public Object invokeMethod(String name, Object args)
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
name
- the name of the method to callargs
- the arguments to use for the method call
public Object[] getValues()
public GString plus(GString that)
public GString plus(String that)
public int getValueCount()
public Object getValue(int idx)
public String toString()
toString
in interface CharSequence
toString
in class Object
public Writer writeTo(Writer out) throws IOException
Writable
Writes this object to the given writer.
This 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.)
writeTo
in interface Writable
out
- the Writer to which this Writable should output its data.
IOException
- if an error occurred while outputting data to the
writerpublic void build(GroovyObject builder)
build
in interface Buildable
public boolean equals(Object that)
equals
in class Object
public boolean equals(GString that)
public int hashCode()
hashCode
in class Object
public int compareTo(Object that)
compareTo
in interface Comparable
public char charAt(int index)
charAt
in interface CharSequence
public int length()
length
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public Pattern negate()
|
Copyright © 2003-2009 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |