I18NHelper
java.lang.Object
∟ javax.jdo.spi.I18NHelper
Helper class for constructing messages from bundles. The intended usage of this class is to construct a new instance bound to a bundle, as in
I18NHelper msg = I18NHelper.getInstance("javax.jdo.Bundle");
This call uses the class loader that loaded the I18NHelper class to find the specified Bundle. The class provides two overloaded getInstance methods allowing to specify a different class loader: (Class cls) looks for a bundle called "Bundle.properties" located in the package of the specified class object and (String bundleName,ClassLoader loader) uses the specified class loader to find the bundle.
Subsequently, instance methods can be used to format message strings using the text from the bundle, as in
throw new JDOFatalInternalException (msg.msg("ERR_NoMetadata",
cls.getName()));
- Since:
- JDO 1.0
Public Methods
ResourceBundle getResourceBundle()
- Return:
- the associated resource bundle
- Since:
- JDO 1.1
String msg(String messageKey)
- Parameters:
messageKey
- the message key
- Return:
- the resolved message text
- Since:
- JDO 1.0
String msg(String messageKey, Object arg1)
- Parameters:
messageKey
- the message keyarg1
- the first argument
- Return:
- the resolved message text
- Since:
- JDO 1.0
String msg(String messageKey, Object arg1, Object arg2)
- Parameters:
messageKey
- the message keyarg1
- the first argumentarg2
- the second argument
- Return:
- the resolved message text
- Since:
- JDO 1.0
String msg(String messageKey, Object arg1, Object arg2, Object arg3)
- Parameters:
messageKey
- the message keyarg1
- the first argumentarg2
- the second argumentarg3
- the third argument
- Return:
- the resolved message text
- Since:
- JDO 1.0
String msg(String messageKey, Object[] args)
- Parameters:
messageKey
- the message keyargs
- the array of arguments
- Return:
- the resolved message text
- Since:
- JDO 1.0
String msg(String messageKey, boolean arg)
- Parameters:
messageKey
- the message keyarg
- the argument
- Return:
- the resolved message text
- Since:
- JDO 1.0
String msg(String messageKey, int arg)
- Parameters:
messageKey
- the message keyarg
- the argument
- Return:
- the resolved message text
- Since:
- JDO 1.0
Public Static Methods
This method figures out the bundle name for the class object's package and uses the class' class loader to find the bundle. Note, the specified class object must not be
null
. - Parameters:
cls
- the class object from which to load the resource bundle
- Return:
- the helper instance bound to the bundle
- Since:
- JDO 1.0
This method uses the current class loader to find the bundle.
- Parameters:
bundleName
- the name of the bundle
- Return:
- the helper instance bound to the bundle
- Since:
- JDO 1.0
This method uses the specified class loader to find the bundle. Note, the specified class loader must not be
null
. - Parameters:
bundleName
- the name of the bundleloader
- the class loader from which to load the resource bundle
- Return:
- the helper instance bound to the bundle
- Since:
- JDO 1.0