org.geotools.util
Class AbstractInternationalString

java.lang.Object
  extended byorg.geotools.util.AbstractInternationalString
All Implemented Interfaces:
java.lang.CharSequence, java.lang.Comparable, org.opengis.util.InternationalString
Direct Known Subclasses:
GrowableInternationalString, ResourceInternationalString, SimpleInternationalString

public abstract class AbstractInternationalString
extends java.lang.Object
implements org.opengis.util.InternationalString

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
Version:
$Id: AbstractInternationalString.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Constructor Summary
AbstractInternationalString()
          Constructs an international string.
 
Method Summary
 char charAt(int index)
          Returns the character of the string in the default locale at the specified index.
 int compareTo(java.lang.Object object)
          Compare this string with the specified object for order.
 int length()
          Returns the length of the string in the default locale.
 java.lang.CharSequence subSequence(int start, int end)
          Returns a subsequence of the string in the default locale.
 java.lang.String toString()
          Returns this string in the default locale.
abstract  java.lang.String toString(java.util.Locale locale)
          Returns this string in the given locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractInternationalString

public AbstractInternationalString()
Constructs an international string.

Method Detail

length

public int length()
Returns the length of the string in the default locale. This is the length of the string returned by toString().

Specified by:
length in interface java.lang.CharSequence

charAt

public char charAt(int index)
            throws java.lang.IndexOutOfBoundsException
Returns the character of the string in the default locale at the specified index. This is the character of the string returned by toString().

Specified by:
charAt in interface java.lang.CharSequence
Parameters:
index - The index of the character.
Returns:
The character at the specified index.
Throws:
java.lang.IndexOutOfBoundsException - if the specified index is out of bounds.

subSequence

public java.lang.CharSequence subSequence(int start,
                                          int end)
Returns a subsequence of the string in the default locale. The subsequence is a String object starting with the character value at the specified index and ending with the character value at index .

Specified by:
subSequence in interface java.lang.CharSequence
Parameters:
start - The start index, inclusive.
end - The end index, exclusive.
Returns:
The specified subsequence.
Throws:
java.lang.IndexOutOfBoundsException - if or is out of range.

toString

public abstract java.lang.String toString(java.util.Locale locale)
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:
toString in interface org.opengis.util.InternationalString
Parameters:
locale - The desired locale for the string to be returned, or for a string in the implementation default locale.
Returns:
The string in the given locale if available, or in the default locale otherwise.

toString

public java.lang.String toString()
Returns this string in the default locale. Invoking this method is equivalent to invoking toString(Locale.getDefault()). All methods from CharSequence operate on this string. This string is also used as the criterion for natural ordering.

Specified by:
toString in interface org.opengis.util.InternationalString
Returns:
The string in the default locale.

compareTo

public int compareTo(java.lang.Object object)
Compare this string with the specified object for order. This method compare the string in the default locale, as returned by toString().

Specified by:
compareTo in interface java.lang.Comparable


Copyright © GeoTools. All Rights Reserved.