public abstract class AbstractInternationalString extends Object implements InternationalString, Formattable
InternationalString interface is used instead of the String class
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-wide default locale.
The natural ordering is defined by the value returned by toString().
CodeList value. This can be done with:
Types.getCodeTitle(CodeList) for getting the InternationalString
instance to store in a metadata property.Types.forCodeTitle(CharSequence) for retrieving the CodeList
previously stored as an InternationalString.Defined in the sis-utility module
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractInternationalString()
Constructs an international string.
|
| Modifier and Type | Method and Description |
|---|---|
char |
charAt(int index)
Returns the character of the string in the default locale
at the specified index.
|
int |
compareTo(InternationalString object)
Compares this string with the specified object for order.
|
void |
formatTo(Formatter formatter,
int flags,
int width,
int precision)
Formats this international string using the given formatter.
|
int |
length()
Returns the length of the string in the default locale.
|
CharSequence |
subSequence(int start,
int end)
Returns a subsequence of the string in the default locale.
|
String |
toString()
Returns this string in the default locale.
|
abstract String |
toString(Locale locale)
Returns this string in the given locale.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitchars, codePointsprotected AbstractInternationalString()
public int length()
toString().length in interface CharSequencepublic char charAt(int index)
throws IndexOutOfBoundsException
toString().charAt in interface CharSequenceindex - the index of the character.IndexOutOfBoundsException - if the specified index is out of bounds.public CharSequence subSequence(int start, int end)
String object starting with the character value at the specified
index and ending with the character value at index end - 1.subSequence in interface CharSequencestart - the start index, inclusive.end - the end index, exclusive.IndexOutOfBoundsException - if start or end is out of range.public abstract String toString(Locale locale)
toString() method.
Locale.ROOT argument valueLocale.ROOT can be given to this method for requesting a "unlocalized" string,
typically some programmatic values like enumerations or identifiers. While identifiers
often look like English words, Locale.ROOT is not considered synonymous to
Locale.ENGLISH because the values may differ in the way numbers and dates are
formatted (e.g. using the ISO 8601 standard for dates instead than English conventions).
null argument valueLocale.ROOT constant is new in Java 6. Some other libraries designed for Java 5
use the null value for "unlocalized" strings. Apache SIS accepts null value
for inter-operability with those libraries. However the behavior is implementation dependent:
some subclasses will take null as a synonymous of the system default locale, while
other subclasses will take null as a synonymous of the root locale. In order to
ensure determinist behavior, client code are encouraged to specify only non-null values.toString in interface InternationalStringlocale - the desired locale for the string to be returned.Locale.getDefault(),
Locale.ROOTpublic String toString()
toString(Locale.getDefault()).
All methods from CharSequence operate on this string.
This string is also used as the criterion for natural ordering.
toString in interface CharSequencetoString in interface InternationalStringtoString in class Objectpublic void formatTo(Formatter formatter, int flags, int width, int precision)
toString(formatter.Formatter.locale())
formatTo in interface Formattableformatter - the formatter to use for formatting this string.flags - a bitmask of FormattableFlags values.width - the minimum number of characters, or -1 if none.precision - the maximum number of characters (before expanding to the width),
or -1 for no restriction.public int compareTo(InternationalString object)
toString().compareTo in interface Comparable<InternationalString>object - the string to compare with this string.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.