org.pentaho.platform.util.messages
Class MessageUtil
java.lang.Object
org.pentaho.platform.util.messages.MessageUtil
public class MessageUtil
- extends Object
MessageUtil
public MessageUtil()
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 the
msg
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 the msg
parameter
from the resource file.msg
- String containing the message that was obtained from the resource file using
the key
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,
String... 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. see
formatErrorMessage
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,
String... params)
formatMessage
public static String formatMessage(String pattern,
String... params)