|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.util.AbstractInternationalString org.geotools.util.GrowableInternationalString
An implementation of international string using a map of strings for different locales. Strings for new locales can be added, but existing strings can't be removed or modified. This behavior is a compromise between making constructionss easier, and being suitable for use in immutable objects.
Constructor Summary | |
GrowableInternationalString()
Constructs an initially empty international string. |
|
GrowableInternationalString(java.lang.String string)
Constructs an international string initialized with the specified string. |
Method Summary | |
void |
add(java.util.Locale locale,
java.lang.String string)
Add a string for the given locale. |
boolean |
add(java.lang.String prefix,
java.lang.String key,
java.lang.String string)
Add a string for the given property key. |
boolean |
equals(java.lang.Object object)
Compares this international string with the specified object for equality. |
java.util.Set |
getLocales()
Returns the set of locales defined in this international string. |
int |
hashCode()
Returns a hash code value for this international text. |
java.lang.String |
toString(java.util.Locale locale)
Returns a string in the specified locale. |
Methods inherited from class org.geotools.util.AbstractInternationalString |
charAt, compareTo, length, subSequence, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GrowableInternationalString()
add(...)
methods.
public GrowableInternationalString(java.lang.String string)
add(...)
methods. The string specified to this constructor is the one that will be
returned if no localized string is found for the Locale
argument
in a call to toString(Locale)
.
string
- The string in no specific locale.Method Detail |
public void add(java.util.Locale locale, java.lang.String string) throws java.lang.IllegalArgumentException
locale
- The locale for the value, or .string
- The localized string.
java.lang.IllegalArgumentException
- if a different string value was already set for
the given locale.public boolean add(java.lang.String prefix, java.lang.String key, java.lang.String string) throws java.lang.IllegalArgumentException
Map
. It infers the Locale
from the property , using the following steps:
add(Locale,String)
method is
invoked.For example if the prefix is "remarks"
, then the "remarks_fr"
property key stands for remarks in French while the
"remarks_fr_CA"
property key stands for remarks in
French Canadian.
prefix
- The prefix to skip at the begining of the .key
- The property key.string
- The localized string for the specified .
java.lang.IllegalArgumentException
- if the locale after the prefix is an illegal code, or a
different string value was already set for the given locale.public java.util.Set getLocales()
public java.lang.String toString(java.util.Locale locale)
"fr_CA"
locale was requested but not found, then
this method looks for the "fr"
locale. The locale
(which stand for unlocalized message) is tried last.
toString
in interface org.opengis.util.InternationalString
toString
in class AbstractInternationalString
locale
- The locale to look for, or .
public boolean equals(java.lang.Object object)
public int hashCode()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |