Package org.apache.sis.util.resources
Class Messages
java.lang.Object
java.util.ResourceBundle
org.apache.sis.util.resources.IndexedResourceBundle
org.apache.sis.util.resources.Messages
- All Implemented Interfaces:
Localized
Locale-dependent resources for miscellaneous (often logging) messages.
- Since:
- 0.3
- Version:
- 0.8
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
The international string to be returned byformatInternational(short)
.static final class
Resource keys.Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
Field Summary
Fields inherited from class org.apache.sis.util.resources.IndexedResourceBundle
FIRST, LOCALE_KEY
Fields inherited from class java.util.ResourceBundle
parent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
format
(short key) Gets a string for the given key from this resource bundle or one of its parents.static String
Gets a string for the given key and replaces all occurrence of "{0}" with value ofarg0
.static String
Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values ofarg0
,arg1
.static String
Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values ofarg0
,arg1
, etc.static String
Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values ofarg0
,arg1
, etc.static org.opengis.util.InternationalString
formatInternational
(short key) Gets an international string for the given key.static org.opengis.util.InternationalString
formatInternational
(short key, Object arg) Gets an international string for the given key.static org.opengis.util.InternationalString
formatInternational
(short key, Object... args) Gets an international string for the given key.protected KeyConstants
Returns the handle for theKeys
constants.static Messages
getResources
(Locale locale) Returns resources in the given locale.Methods inherited from class org.apache.sis.util.resources.IndexedResourceBundle
appendLabel, getBundle, getKeys, getLabel, getLocale, getLogRecord, getLogRecord, getLogRecord, getLogRecord, getLogRecord, getString, getString, getString, getString, getString, getString, handleGetObject, list, toArray, toLabel, toString
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParent
-
Constructor Details
-
Messages
Messages(URL resources) Constructs a new resource bundle loading data from the given UTF file.- Parameters:
resources
- the path of the binary file containing resources, ornull
if there are no resources. The resources may be a file or an entry in a JAR file.
-
-
Method Details
-
getKeyConstants
Returns the handle for theKeys
constants.- Overrides:
getKeyConstants
in classIndexedResourceBundle
- Returns:
- a handler for the constants declared in the inner
Keys
class.
-
getResources
Returns resources in the given locale.- Parameters:
locale
- the locale, ornull
for the default locale.- Returns:
- resources in the given locale.
- Throws:
MissingResourceException
- if resources cannot be found.
-
format
Gets a string for the given key from this resource bundle or one of its parents.- Parameters:
key
- the key for the desired string.- Returns:
- the string for the given key.
- Throws:
MissingResourceException
- if no object for the given key can be found.
-
format
Gets a string for the given key and replaces all occurrence of "{0}" with value ofarg0
.- Parameters:
key
- the key for the desired string.arg0
- value to substitute to "{0}".- Returns:
- the formatted string for the given key.
- Throws:
MissingResourceException
- if no object for the given key can be found.
-
format
Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values ofarg0
,arg1
.- Parameters:
key
- the key for the desired string.arg0
- value to substitute to "{0}".arg1
- value to substitute to "{1}".- Returns:
- the formatted string for the given key.
- Throws:
MissingResourceException
- if no object for the given key can be found.
-
format
public static String format(short key, Object arg0, Object arg1, Object arg2) throws MissingResourceException Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values ofarg0
,arg1
, etc.- Parameters:
key
- the key for the desired string.arg0
- value to substitute to "{0}".arg1
- value to substitute to "{1}".arg2
- value to substitute to "{2}".- Returns:
- the formatted string for the given key.
- Throws:
MissingResourceException
- if no object for the given key can be found.
-
format
public static String format(short key, Object arg0, Object arg1, Object arg2, Object arg3) throws MissingResourceException Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values ofarg0
,arg1
, etc.- Parameters:
key
- the key for the desired string.arg0
- value to substitute to "{0}".arg1
- value to substitute to "{1}".arg2
- value to substitute to "{2}".arg3
- value to substitute to "{3}".- Returns:
- the formatted string for the given key.
- Throws:
MissingResourceException
- if no object for the given key can be found.
-
formatInternational
public static org.opengis.util.InternationalString formatInternational(short key) Gets an international string for the given key. This method does not check for the key validity. If the key is invalid, then aMissingResourceException
may be thrown when aInternationalString.toString(Locale)
method is invoked.- Parameters:
key
- the key for the desired string.- Returns:
- an international string for the given key.
-
formatInternational
Gets an international string for the given key. This method does not check for the key validity. If the key is invalid, then aMissingResourceException
may be thrown when aInternationalString.toString(Locale)
method is invoked.API note: This method is redundant with the one expectingObject...
, but avoid the creation of a temporary array. There is no risk of confusion since the two methods delegate their work to the sameformat
method anyway.- Parameters:
key
- the key for the desired string.arg
- values to substitute to "{0}".- Returns:
- an international string for the given key.
-
formatInternational
Gets an international string for the given key. This method does not check for the key validity. If the key is invalid, then aMissingResourceException
may be thrown when aInternationalString.toString(Locale)
method is invoked.- Parameters:
key
- the key for the desired string.args
- values to substitute to "{0}", "{1}", etc.- Returns:
- an international string for the given key.
-