Package org.geotools.util
Class AbstractInternationalString
Object
AbstractInternationalString
- All Implemented Interfaces:
CharSequence,Comparable<InternationalString>,InternationalString
- Direct Known Subclasses:
GrowableInternationalString,ResourceInternationalString,SimpleInternationalString
A string that has been internationalized into several locales. This class is
used as a replacement for the
String type whenever an attribute needs to be internationalization capable. The
default value (as returned by toString() and other CharSequence methods} is the string in the
current system default.
The natural ordering is defined by the string in default
locale, as returned by toString(). This string also defines the character
sequence.
- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncharcharAt(int index) Returns the character of the string in the default locale at the specified index.intcompareTo(InternationalString object) Compares this string with the specified object for order.intlength()Returns the length of the string in the default locale.subSequence(int start, int end) Returns a subsequence of the string in the default locale.toString()Returns this string in the default locale.abstract StringReturns this string in the given locale.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
AbstractInternationalString
public AbstractInternationalString()Constructs an international string.
-
-
Method Details
-
length
public int length()Returns the length of the string in the default locale. This is the length of the string returned bytoString().- Specified by:
lengthin interfaceCharSequence
-
charAt
Returns the character of the string in the default locale at the specified index. This is the character of the string returned bytoString().- Specified by:
charAtin interfaceCharSequence- Parameters:
index- The index of the character.- Returns:
- The character at the specified index.
- Throws:
IndexOutOfBoundsException- if the specified index is out of bounds.
-
subSequence
Returns a subsequence of the string in the default locale. The subsequence is aStringobject starting with the character value at the specified index and ending with the character value at indexend - 1.- Specified by:
subSequencein interfaceCharSequence- Parameters:
start- The start index, inclusive.end- The end index, exclusive.- Returns:
- The specified subsequence.
- Throws:
IndexOutOfBoundsException- ifstartorendis out of range.
-
toString
Returns this string in the given locale. If no string is available in the given locale, then some default locale is used. The default locale is implementation-dependent. It may or may not be the system default).- Specified by:
toStringin interfaceInternationalString- Parameters:
locale- The desired locale for the string to be returned, ornullfor a string in the implementation default locale.- Returns:
- The string in the given locale if available, or in the default locale otherwise.
-
toString
Returns this string in the default locale. Invoking this method is equivalent to invokingtoString(Locale.getDefault()). All methods fromCharSequenceoperate on this string. This string is also used as the criterion for natural ordering.- Specified by:
toStringin interfaceCharSequence- Specified by:
toStringin interfaceInternationalString- Overrides:
toStringin classObject- Returns:
- The string in the default locale.
-
compareTo
Compares this string with the specified object for order. This method compare the string in the default locale, as returned bytoString().- Specified by:
compareToin interfaceComparable<InternationalString>- Parameters:
object- The string to compare with this string.- Returns:
- A negative number if this string is before the given string, a positive number if after, or 0 if equals.
-