Class MessageUtil
- java.lang.Object
-
- org.pentaho.platform.util.messages.MessageUtil
-
public class MessageUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description MessageUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
formatErrorMessage(String key, String msg)
Get a formatted error message.static String
formatMessage(String pattern, Object... params)
static String
getErrorString(ResourceBundle bundle, String key)
Get a message from the specified resource bundle using the specified key, and format it.static String
getErrorString(ResourceBundle bundle, String key, Object... params)
static String
getString(ResourceBundle bundle, String key)
Get the message from the specified resource bundle using the specified key.static String
getString(ResourceBundle bundle, String key, Object... params)
-
-
-
Method Detail
-
formatErrorMessage
public static String formatErrorMessage(String key, String msg)
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."- 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.
-
getString
public static String getString(ResourceBundle bundle, String key)
Get the message from the specified resource bundle using the specified key.- Parameters:
bundle
- ResourceBundle containing the desired Stringkey
- String containing the key to locate the desired String in the ResourceBundle.- Returns:
- String containing the message from the specified resource bundle accessed using the specified key
-
getString
public static String getString(ResourceBundle bundle, String key, Object... params)
-
getErrorString
public static String getErrorString(ResourceBundle bundle, String key)
Get a message from the specified resource bundle using the specified key, and format it. seeformatErrorMessage
for details on how the message is formatted.- Parameters:
bundle
- ResourceBundle containing the desired Stringkey
- String containing the key to locate the desired String in the ResourceBundle.- Returns:
- String containing the formatted message.
-
getErrorString
public static String getErrorString(ResourceBundle bundle, String key, Object... params)
-
-