| java.lang.Object org.geotools.util.AbstractInternationalString org.geotools.util.GrowableInternationalString
GrowableInternationalString | public class GrowableInternationalString extends AbstractInternationalString implements Serializable(Code) | | An implementation of international string using a
of strings for different
. Strings for new
locales can be
, 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.
since: 2.1 version: $Id: GrowableInternationalString.java 27848 2007-11-12 13:10:32Z desruisseaux $ author: Martin Desruisseaux |
Method Summary | |
public synchronized void | add(Locale locale, String string) Add a string for the given locale. | public boolean | add(String prefix, String key, String string) Add a string for the given property key. | public boolean | equals(Object object) Compares this international string with the specified object for equality. | public Set | getLocales() Returns the set of locales defined in this international string. | public int | hashCode() Returns a hash code value for this international text. | public boolean | isSubsetOf(Object candidate) Returns
true if all localized texts stored in this international string are
contained in the specified object. | public String | toString(Locale locale) Returns a string in the specified locale. |
GrowableInternationalString | public GrowableInternationalString()(Code) | | Constructs an initially empty international string. Localized strings can been added
using one of
GrowableInternationalString.add add(...) methods.
|
GrowableInternationalString | public GrowableInternationalString(String string)(Code) | | Constructs an international string initialized with the specified string.
Additional localized strings can been added using one of
GrowableInternationalString.add 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
GrowableInternationalString.toString(Locale) .
Parameters: string - The string in no specific locale. |
add | public synchronized void add(Locale locale, String string) throws IllegalArgumentException(Code) | | Add a string for the given locale.
Parameters: locale - The locale for the string value, or null . Parameters: string - The localized string. throws: IllegalArgumentException - if a different string value was already set forthe given locale. |
add | public boolean add(String prefix, String key, String string) throws IllegalArgumentException(Code) | | Add a string for the given property key. This is a convenience method for constructing an
AbstractInternationalString during iteration through the
in a
Map . It infers the
Locale from the property
key , using the following steps:
- If the
key do not starts with the specified
prefix , then
this method do nothing and returns
false .
- Otherwise, the characters after the
prefix are parsed as an ISO language
and country code, and the
GrowableInternationalString.add(Locale,String) method is
invoked.
For example if the prefix is "remarks" , then the "remarks_fr"
property key stands for remarks in
while the
"remarks_fr_CA" property key stands for remarks in
.
Parameters: prefix - The prefix to skip at the begining of the key . Parameters: key - The property key. Parameters: string - The localized string for the specified key . true if the key has been recognized, or false otherwise. throws: IllegalArgumentException - if the locale after the prefix is an illegal code, or adifferent string value was already set for the given locale. |
equals | public boolean equals(Object object)(Code) | | Compares this international string with the specified object for equality.
|
getLocales | public Set getLocales()(Code) | | Returns the set of locales defined in this international string.
|
hashCode | public int hashCode()(Code) | | Returns a hash code value for this international text.
|
isSubsetOf | public boolean isSubsetOf(Object candidate)(Code) | | Returns
true if all localized texts stored in this international string are
contained in the specified object. More specifically:
If
candidate is an instance of
InternationalString , then this method
returns
true if, for all
-
pairs contained in
this , candidate.
(locale) returns a string
to
string .
If
candidate is an instance of
CharSequence , then this method
returns
true if
GrowableInternationalString.toString(Locale) returns a string
to candidate.
for all locales.
If
candidate is an instance of
Map , then this methods returns
true if all
-
pairs are contained into
candidate .
Otherwise, this method returns
false .
since: 2.3 |
toString | public String toString(Locale locale)(Code) | | Returns a string in the specified locale. If there is no string for the specified
locale , then this method search for a locale without the
part. If no string are found,
then this method search for a locale without the
part. For example if the "fr_CA" locale was requested but not found, then
this method looks for the "fr" locale. The
null locale
(which stand for unlocalized message) is tried last.
Parameters: locale - The locale to look for, or null . The string in the specified locale, or in a default locale. |
Fields inherited from org.geotools.util.AbstractInternationalString | transient String defaultValue(Code)(Java Doc)
|
|
|