| java.lang.Object org.geotools.util.AbstractInternationalString org.geotools.util.ResourceInternationalString
ResourceInternationalString | public class ResourceInternationalString extends AbstractInternationalString implements Serializable(Code) | | An international string backed by a
. A resource
bundle can be a Java class or a
file, one for
each language. The constructor expects the fully qualified class name of the base resource
bundle (the one used when no resource was found in the client's language). The right resource
bundle is loaded at runtime for the client's language by looking for a class or a
file with the right suffix ("
_en " for
English or "
_fr " for French). This mechanism is explained in J2SE's javadoc for the
ResourceBundle.getBundle(StringLocaleClassLoader) getBundle static method.
Example: If a file named "
MyResources.properties " exists in the package
"
org.geotools.mypackage " and contains a line like "
MyKey = some value ",
then an international string for "
some value " can be created using the following
code:
InternationalString value = new ResourceInternationalString(
"org.geotools.mypackage.MyResources", "MyKey");
The "
some value " string will be localized if the required properties files exist, for
example "
MyResources_fr.properties " for French, "
MyResources_it.properties "
for Italian, etc.
since: 2.1 version: $Id: ResourceInternationalString.java 23493 2006-12-17 04:47:25Z desruisseaux $ author: Martin Desruisseaux |
Method Summary | |
public boolean | equals(Object object) Compares this international string with the specified object for equality. | public int | hashCode() Returns a hash code value for this international text. | public String | toString(Locale locale) Returns a string in the specified locale. |
ResourceInternationalString | public ResourceInternationalString(String resources, String key)(Code) | | Creates a new international string from the specified resource bundle and key.
Parameters: resources - The name of the resource bundle, as a fully qualified class name. Parameters: key - The key for the resource to fetch. |
equals | public boolean equals(Object object)(Code) | | Compares this international string with the specified object for equality.
|
hashCode | public int hashCode()(Code) | | Returns a hash code value for this international text.
|
toString | public String toString(Locale locale) throws MissingResourceException(Code) | | Returns a string in the specified locale. If there is no string for the specified
locale , then this method search for a string in an other locale as
specified in the
ResourceBundle class description.
Parameters: locale - The locale to look for, or null for an unlocalized version. The string in the specified locale, or in a default locale. throws: MissingResourceException - is the key given to the constructor is invalid. |
Fields inherited from org.geotools.util.AbstractInternationalString | transient String defaultValue(Code)(Java Doc)
|
|
|