org.geotools.util
Class SimpleInternationalString

Object
  extended by AbstractInternationalString
      extended by SimpleInternationalString
All Implemented Interfaces:
Serializable, CharSequence, Comparable<InternationalString>, InternationalString

public class SimpleInternationalString
extends AbstractInternationalString
implements Serializable

A simple international string consisting of a single string for all locales. For such a particular case, this implementation is the more effective than other implementations provided in this package.

Since:
2.1
Author:
Martin Desruisseaux (IRD)
See Also:
Serialized Form

Constructor Summary
SimpleInternationalString(String message)
          Creates a new instance of international string.
 
Method Summary
 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(Locale locale)
          Returns the same string for all locales.
static AbstractInternationalString wrap(CharSequence string)
          If the specified string is null or an instance of AbstractInternationalString, returns it unchanged.
 
Methods inherited from class AbstractInternationalString
charAt, compareTo, length, subSequence, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleInternationalString

public SimpleInternationalString(String message)
Creates a new instance of international string.

Parameters:
message - The string for all locales.
Method Detail

wrap

public static AbstractInternationalString wrap(CharSequence string)
If the specified string is null or an instance of AbstractInternationalString, returns it unchanged. Otherwise, wraps the string value in a SimpleInternationalString.

Parameters:
string - The string to wrap.
Returns:
The given string as an international string.

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 interface InternationalString
Specified by:
toString in class AbstractInternationalString
Parameters:
locale - The desired locale for the string to be returned, or null for a string in the implementation default locale.
Returns:
The string in the given locale if available, or in the default locale otherwise.

equals

public boolean equals(Object object)
Compares this international string with the specified object for equality.

Overrides:
equals in class Object
Parameters:
object - The object to compare with this international string.
Returns:
true if the given object is equals to this string.

hashCode

public int hashCode()
Returns a hash code value for this international text.

Overrides:
hashCode in class Object


Copyright © 1996-2014 Geotools. All Rights Reserved.