| java.lang.Object org.apache.derby.shared.common.i18n.MessageUtil
MessageUtil | public class MessageUtil (Code) | | Class comments here
|
Field Summary | |
final public static Locale | US |
Constructor Summary | |
public | MessageUtil(String resourceBundleName) Create an instance of MessageUtil with a specific resource
bundle. |
Method Summary | |
public static String | composeDefaultMessage(String message, Object[] arguments) Compose a default message so that the user at least gets
something* useful rather than just a MissingResourceException,
which is particularly unhelpful
Parameters: message - The message to start with, which often is null Parameters: arguments - The arguments to the message. | public static String | formatMessage(ResourceBundle bundle, String messageId, Object[] arguments, boolean composeDefault) Format a message given a resource bundle and a message id.
The arguments to the messages are passed via an object array. | public String | getCompleteMessage(String messageID, Object[] args) | public static String | getCompleteMessage(Locale locale, String resourceBundleName, String messageId, Object[] arguments, boolean composeDefault) Generic routine to get a message with any number of arguments.
Looks in the provided resource bundle for the message, using the
specified locale and then the US locale. | public static String | getCompleteMessage(String messageId, String resourceBundleName, Object[] arguments) This is a wrapper for the getCompleteMessage workhorse routine
using some obvious defaults, particularly for non-engine subsystems
that only ever use the default locale.
Get a message using the default locale. | public String | getTextMessage(String messageID) | public String | getTextMessage(String messageID, Object a1) | public String | getTextMessage(String messageID, Object a1, Object a2) | public String | getTextMessage(String messageID, Object a1, Object a2, Object a3) | public String | getTextMessage(String messageID, Object a1, Object a2, Object a3, Object a4) |
MessageUtil | public MessageUtil(String resourceBundleName)(Code) | | Create an instance of MessageUtil with a specific resource
bundle. This assumes the default locale, which is just fine for
users of this class other than the engine (which potentially has
a different locale and a different resource bundle for each
invocation of getCompleteMessage().
Parameters: resourceBundleName - The base name of the resource bundle to use. |
composeDefaultMessage | public static String composeDefaultMessage(String message, Object[] arguments)(Code) | | Compose a default message so that the user at least gets
something* useful rather than just a MissingResourceException,
which is particularly unhelpful
Parameters: message - The message to start with, which often is null Parameters: arguments - The arguments to the message. |
formatMessage | public static String formatMessage(ResourceBundle bundle, String messageId, Object[] arguments, boolean composeDefault)(Code) | | Format a message given a resource bundle and a message id.
The arguments to the messages are passed via an object array. The objects
in the array WILL be changed by this class. The caller should NOT get the
object back from this array.
Parameters: bundle - The resource bundle to use to look for the message Parameters: messageId - The message id to use for the message Parameters: arguments - The arguments for the message Parameters: composeDefault - Indicates whether a default message should be composed ifthe message can't be found in the resource bundle. If composeDefault is false, this method willthrow a MissingResourceException if the message could not befound. If composeDefault is true, then if the message id is not found inthe given bundle, this method composes and returns as helpful a message as possible in the format "UNKNOWN : [arg1], [arg2], ..." |
getCompleteMessage | public String getCompleteMessage(String messageID, Object[] args)(Code) | | Instance method to get the complete message, using the
provided resource bundle name as specified when this
instance was constructed
If for some reason the message could not be found, we return a
default message using the message arguments
|
getCompleteMessage | public static String getCompleteMessage(Locale locale, String resourceBundleName, String messageId, Object[] arguments, boolean composeDefault) throws MissingResourceException(Code) | | Generic routine to get a message with any number of arguments.
Looks in the provided resource bundle for the message, using the
specified locale and then the US locale.
Parameters: locale - The locale to use when looking for the message. If the messageis not found using this locale, we attempt to find it using theUS locale (our default). Parameters: resourceBundleName - The base name for the resource bundle to use. Parameters: messageId - The message identifier for this message Parameters: arguments - The arguments for the message Parameters: composeDefault - If this is true, this method will compose a default message ifthe message could not be found in theprovided resource bundles. If it is false, this method willthrow a MissingResourceException if the message could not befound.The message for the given message id, with argumentssubstituted. throws: MissingResourceException - If the message could not be found and the composeDefault parameter was set to false. |
getCompleteMessage | public static String getCompleteMessage(String messageId, String resourceBundleName, Object[] arguments) throws MissingResourceException(Code) | | This is a wrapper for the getCompleteMessage workhorse routine
using some obvious defaults, particularly for non-engine subsystems
that only ever use the default locale.
Get a message using the default locale. If the message is not found
with the default locale, use the US locale. Do this both for the
common bundle and the parent bundle.
If the message is not found in common or in the parent resource
bundle, return a default message composed of the message arguments.
Parameters: messageId - The id to use to look up the message Parameters: resourceBundleName - The base name of the resource bundle to use. Parameters: arguments - The arguments to the message |
getTextMessage | public String getTextMessage(String messageID)(Code) | | Get a message with default locale - no arguments
|
getTextMessage | public String getTextMessage(String messageID, Object a1)(Code) | | Get a message with default locale - one argument
|
|
|