Top Description Fields Constructors Methods
org.codehaus.groovy.runtime

public Class GStringImpl

extends GString
Class Inheritance
Imports
groovy.lang.GString, java.nio.charset.Charset, java.util.Locale

Default implementation of a GString used by the compiler. A GString consist of a list of values and strings which can be combined to create a new String.
See Also
groovy.lang.GString

Field Summary

Modifier and TypeField and Description
private static final long
private final String[]
Inherited from groovy.lang.GString:
EMPTYEMPTY_OBJECT_ARRAYEMPTY_STRING_ARRAY

Constructor Summary

AccessConstructor and Description
public
GStringImpl(Object[]
the value parts
values
,
String[]
the string parts
strings
)

Create a new GString with values and strings.

Method Summary

Modifier and TypeMethod and Description
public int
codePointAt(int index)

public int
codePointBefore(int index)

public int
codePointCount(int beginIndex, int endIndex)

public int
compareTo(String
the object to be compared.
anotherString
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public int
public String
public boolean
public boolean
public boolean
public boolean
endsWith(String suffix)

public boolean
equalsIgnoreCase(String anotherString)

public byte[]
getBytes(Charset charset)

public void
getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)

public String[]
getStrings()

Implements abstract groovy.lang.GString.getStrings.

Get the strings of this GString.
public int
indexOf(int ch)

public int
indexOf(int ch, int fromIndex)

public int
public int
indexOf(String str, int fromIndex)

public String
public boolean
isEmpty()

Overrides default java.lang.CharSequence.isEmpty.

Returns true if this character sequence is empty.
public int
lastIndexOf(int ch)

public int
lastIndexOf(int ch, int fromIndex)

public int
public int
lastIndexOf(String str, int fromIndex)

public boolean
matches(String regex)

public int
offsetByCodePoints(int index, int codePointOffset)

public boolean
regionMatches(int toffset, String other, int ooffset, int len)

public boolean
regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)

public String
replace(char oldChar, char newChar)

public String
replace(CharSequence target, CharSequence replacement)

public String
replaceAll(String regex, String replacement)

public String
replaceFirst(String regex, String replacement)

public String[]
split(String regex, int limit)

public String[]
split(String regex)

public boolean
startsWith(String prefix, int toffset)

public boolean
public String
substring(int beginIndex)

public String
substring(int beginIndex, int endIndex)

public char[]
public String
public String
public String
public String
public String
trim()

Inherited from groovy.lang.GString:
buildcharAtcompareToequalsequalsgetBytesgetBytesgetValuegetValueCountgetValueshashCodeinvokeMethodlengthnegateplusplussubSequencetoStringwriteTo

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides groovy.lang.GString.serialVersionUID.

stringsback to summary
private final String[] strings

Constructor Detail

GStringImplback to summary
public GStringImpl(Object[] values, String[] strings)

Create a new GString with values and strings.

Each value is prefixed by a string, after the last value an additional String might be used. This means strings.length == values.length || strings.length == values.length + 1.

Note

The lengths are not checked. Using different lengths might result in unpredictable behaviour.

Parameters
values:Object[]

the value parts

strings:String[]

the string parts

Method Detail

codePointAtback to summary
public int codePointAt(int index)
codePointBeforeback to summary
public int codePointBefore(int index)
codePointCountback to summary
public int codePointCount(int beginIndex, int endIndex)
compareToback to summary
public int compareTo(String anotherString)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
anotherString:String

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareToIgnoreCaseback to summary
public int compareToIgnoreCase(String str)
concatback to summary
public String concat(String str)
containsback to summary
public boolean contains(CharSequence s)
contentEqualsback to summary
public boolean contentEquals(StringBuffer sb)
contentEqualsback to summary
public boolean contentEquals(CharSequence cs)
endsWithback to summary
public boolean endsWith(String suffix)
equalsIgnoreCaseback to summary
public boolean equalsIgnoreCase(String anotherString)
getBytesback to summary
public byte[] getBytes(Charset charset)
getCharsback to summary
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
getStringsback to summary
public String[] getStrings()

Implements abstract groovy.lang.GString.getStrings.

Get the strings of this GString.

This methods returns the same array as used in the constructor. Changing the values will result in changes of the GString. It is not recommended to do so.

Annotations
@Override
indexOfback to summary
public int indexOf(int ch)
indexOfback to summary
public int indexOf(int ch, int fromIndex)
indexOfback to summary
public int indexOf(String str)
indexOfback to summary
public int indexOf(String str, int fromIndex)
internback to summary
public String intern()
isEmptyback to summary
public boolean isEmpty()

Overrides default java.lang.CharSequence.isEmpty.

Doc from java.lang.CharSequence.isEmpty.

Returns true if this character sequence is empty.

Returns:boolean

true if length() is 0, otherwise false

lastIndexOfback to summary
public int lastIndexOf(int ch)
lastIndexOfback to summary
public int lastIndexOf(int ch, int fromIndex)
lastIndexOfback to summary
public int lastIndexOf(String str)
lastIndexOfback to summary
public int lastIndexOf(String str, int fromIndex)
matchesback to summary
public boolean matches(String regex)
offsetByCodePointsback to summary
public int offsetByCodePoints(int index, int codePointOffset)
regionMatchesback to summary
public boolean regionMatches(int toffset, String other, int ooffset, int len)
regionMatchesback to summary
public boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
replaceback to summary
public String replace(char oldChar, char newChar)
replaceback to summary
public String replace(CharSequence target, CharSequence replacement)
replaceAllback to summary
public String replaceAll(String regex, String replacement)
replaceFirstback to summary
public String replaceFirst(String regex, String replacement)
splitback to summary
public String[] split(String regex, int limit)
splitback to summary
public String[] split(String regex)
startsWithback to summary
public boolean startsWith(String prefix, int toffset)
startsWithback to summary
public boolean startsWith(String prefix)
substringback to summary
public String substring(int beginIndex)
substringback to summary
public String substring(int beginIndex, int endIndex)
toCharArrayback to summary
public char[] toCharArray()
toLowerCaseback to summary
public String toLowerCase(Locale locale)
toLowerCaseback to summary
public String toLowerCase()
toUpperCaseback to summary
public String toUpperCase(Locale locale)
toUpperCaseback to summary
public String toUpperCase()
trimback to summary
public String trim()