Package org.apache.sis.util.iso
Class SimpleInternationalString
- Object
-
- AbstractInternationalString
-
- SimpleInternationalString
-
- All Implemented Interfaces:
Serializable
,CharSequence
,Comparable<InternationalString>
,Formattable
,InternationalString
public class SimpleInternationalString extends AbstractInternationalString implements Serializable
An international string consisting of a single string for all locales. For such a particular case, this implementation is more effective than other implementations provided in this package.InstantiationIf the characters sequence to wrap is known to be aString
instance, then theSimpleInternationalString(String)
constructor is okay. Otherwise use theTypes.toInternationalString(CharSequence)
method.Immutability and thread safetyThis class is immutable and thus inherently thread-safe. Subclasses may or may not be immutable, at implementation choice. But implementers are encouraged to make sure that subclasses remain immutable for more predictable behavior.- Since:
- 0.3
- See Also:
- Serialized Form
Defined in the
sis-utility
module
-
-
Constructor Summary
Constructors Constructor Description SimpleInternationalString(String text)
Creates a new instance from the given string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
Compares this international string with the specified object for equality.int
hashCode()
Returns a hash code value for this international text.String
toString()
Returns the string representation, which is unique for all locales.String
toString(Locale locale)
Returns the same string for all locales.-
Methods inherited from class AbstractInternationalString
charAt, compareTo, formatTo, length, subSequence
-
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface CharSequence
chars, codePoints
-
-
-
-
Constructor Detail
-
SimpleInternationalString
public SimpleInternationalString(String text)
Creates a new instance from the given string. If the type of the text to wrap is the more genericCharSequence
interface, then use theTypes.toInternationalString(CharSequence)
method instead.- Parameters:
text
- the string for all locales.
-
-
Method Detail
-
toString
public String toString()
Returns the string representation, which is unique for all locales.- Specified by:
toString
in interfaceCharSequence
- Specified by:
toString
in interfaceInternationalString
- Overrides:
toString
in classAbstractInternationalString
- Returns:
- the string in the default locale.
-
toString
public String toString(Locale locale)
Returns the same string for all locales. This is the string given to the constructor.- Specified by:
toString
in interfaceInternationalString
- Specified by:
toString
in classAbstractInternationalString
- Parameters:
locale
- ignored in theSimpleInternationalString
implementation.- Returns:
- the international string as a
String
. - See Also:
Locale.getDefault()
,Locale.ROOT
-
equals
public boolean equals(Object object)
Compares this international string with the specified object for equality.
-
-