Class Messages
java.lang.Object
org.pentaho.reporting.libraries.base.util.ResourceBundleSupport
org.pentaho.reporting.libraries.base.util.Messages
A helper class for a simplified resource-bundle access. This class simply ignores all resource-bundle related errors
and prints place-holder strings if a localization key cannot be found.
- Author:
- David Kincade
-
Constructor Summary
ConstructorDescriptionDeprecated.Always provide the classloader to be safe when deployed in weird setups.Messages
(Locale locale, String baseName, ClassLoader classLoader) Creates a new Messages-collection.Messages
(Locale locale, ResourceBundle resourceBundle, String baseName) Deprecated.Always provide the classloader to be safe when deployed in weird setups. -
Method Summary
Modifier and TypeMethodDescriptionformatErrorMessage
(String key, String msg) Get a formatted error message.getErrorString
(String key, String... param1) Get a parametrized formatted error message from the resource-bundle.Formats the message stored in the resource bundle (using a MessageFormat).Methods inherited from class org.pentaho.reporting.libraries.base.util.ResourceBundleSupport
createMenu, formatMessage, formatMessage, formatMessage, getIcon, getIcon, getKeyStroke, getKeyStroke, getLocale, getMnemonic, getOptionalKeyStroke, getOptionalKeyStroke, getOptionalMnemonic, getOptionalString, getResourceBase, getResourceURL, getString, getString, getString, getString, internalGetString, strictString
-
Constructor Details
-
Messages
Creates a new Messages-collection. The locale and baseName will be used to create the resource-bundle that backs up this implementation.- Parameters:
locale
- the locale.baseName
- the baseName of the resource-bundle.- See Also:
-
Messages
Deprecated.Always provide the classloader to be safe when deployed in weird setups. This method will be removed after the next release.Creates a new Messages-collection. The locale and baseName will be used to create the resource-bundle that backs up this implementation.- Parameters:
locale
- the locale.baseName
- the baseName of the resource-bundle.- See Also:
-
Messages
Deprecated.Always provide the classloader to be safe when deployed in weird setups. This method will be removed after the next release.Creates a new Messages-collection. The locale and baseName will be used to create the resource-bundle that backs up this implementation.- Parameters:
locale
- the locale.baseName
- the baseName of the resource-bundle.resourceBundle
- a predefined resource-bundle.
-
-
Method Details
-
getString
Formats the message stored in the resource bundle (using a MessageFormat).- Parameters:
key
- the resourcebundle keyparam1
- the parameter for the message- Returns:
- the formated string
-
formatErrorMessage
Get a formatted error message. The message consists of two parts. The first part is the error numeric Id associated with the key used to identify the message in the resource file. For instance, suppose the error key is MyClass.ERROR_0068_TEST_ERROR. The first part of the error msg would be "0068". The second part of the returned string is simply themsg
parameter. Currently the format is: error key - error msg For instance: "0068 - A test error message." Currently the format is: error key - error msg For instance: "0069 - You were punched by the donkey."- Parameters:
key
- String containing the key that was used to obtain themsg
parameter from the resource file.msg
- String containing the message that was obtained from the resource file using thekey
parameter.- Returns:
- String containing the formatted error message.
-
getErrorString
Get a parametrized formatted error message from the resource-bundle. The message consists of two parts. The first part is the error numeric Id associated with the key used to identify the message in the resource file. For instance, suppose the error key is MyClass.ERROR_0069_DONKEY_PUNCH. The first part of the error msg would be "0069". The second part of the returned string is simply themsg
parameter. Currently the format is: error key - error msg For instance: "0069 - You were punched by the donkey."- Parameters:
key
- String containing the key that was used to obtain themsg
parameter from the resource file.param1
- the parameter for the message- Returns:
- String containing the formatted error message.
-