|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.shared.common.i18n.MessageUtil
public class MessageUtil
Class comments here
Field Summary | |
---|---|
private java.lang.String |
resourceBundleName
The name of the resource bundle we are using to load messages |
static java.util.Locale |
US
|
Constructor Summary | |
---|---|
MessageUtil(java.lang.String resourceBundleName)
Create an instance of MessageUtil with a specific resource bundle. |
Method Summary | |
---|---|
static java.lang.String |
composeDefaultMessage(java.lang.String message,
java.lang.Object[] arguments)
Compose a default message so that the user at least gets *something* useful rather than just a MissingResourceException, which is particularly unhelpful |
private static int |
countParams(java.lang.String message)
Count the number of substituation parameters in the message |
static java.lang.String |
formatMessage(java.util.ResourceBundle bundle,
java.lang.String messageId,
java.lang.Object[] arguments,
boolean composeDefault)
Format a message given a resource bundle and a message id. |
static java.lang.String |
getCompleteMessage(java.util.Locale locale,
java.lang.String resourceBundleName,
java.lang.String messageId,
java.lang.Object[] arguments,
boolean composeDefault)
Generic routine to get a message with any number of arguments. |
java.lang.String |
getCompleteMessage(java.lang.String messageID,
java.lang.Object[] args)
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 |
static java.lang.String |
getCompleteMessage(java.lang.String messageId,
java.lang.String resourceBundleName,
java.lang.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. |
java.lang.String |
getTextMessage(java.lang.String messageID)
Get a message with default locale - no arguments |
java.lang.String |
getTextMessage(java.lang.String messageID,
java.lang.Object a1)
Get a message with default locale - one argument |
java.lang.String |
getTextMessage(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2)
Get a message with default locale - two arguments |
java.lang.String |
getTextMessage(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3)
Get a message with default locale - three arguments |
java.lang.String |
getTextMessage(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4)
Get a message with default locale - four arguments |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.Locale US
private java.lang.String resourceBundleName
Constructor Detail |
---|
public MessageUtil(java.lang.String resourceBundleName)
resourceBundleName
- The base name of the resource bundle to use.Method Detail |
---|
public java.lang.String getTextMessage(java.lang.String messageID)
public java.lang.String getTextMessage(java.lang.String messageID, java.lang.Object a1)
public java.lang.String getTextMessage(java.lang.String messageID, java.lang.Object a1, java.lang.Object a2)
public java.lang.String getTextMessage(java.lang.String messageID, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3)
public java.lang.String getTextMessage(java.lang.String messageID, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4)
public java.lang.String getCompleteMessage(java.lang.String messageID, java.lang.Object[] args)
public static java.lang.String getCompleteMessage(java.util.Locale locale, java.lang.String resourceBundleName, java.lang.String messageId, java.lang.Object[] arguments, boolean composeDefault) throws java.util.MissingResourceException
locale
- The locale to use when looking for the message. If the message
is not found using this locale, we attempt to find it using the
US locale (our default).resourceBundleName
- The base name for the resource bundle to use.messageId
- The message identifier for this messagearguments
- The arguments for the messagecomposeDefault
- If this is true, this method will compose a default message if
the message could not be found in the
provided resource bundles. If it is false, this method will
throw a MissingResourceException if the message could not be
found.
java.util.MissingResourceException
- If the message could not be found and the
composeDefault
parameter was set to false.public static java.lang.String getCompleteMessage(java.lang.String messageId, java.lang.String resourceBundleName, java.lang.Object[] arguments) throws java.util.MissingResourceException
messageId
- The id to use to look up the messageresourceBundleName
- The base name of the resource bundle to use.arguments
- The arguments to the message
java.util.MissingResourceException
public static java.lang.String formatMessage(java.util.ResourceBundle bundle, java.lang.String messageId, java.lang.Object[] arguments, boolean composeDefault)
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.
bundle
- The resource bundle to use to look for the messagemessageId
- The message id to use for the messagearguments
- The arguments for the messagecomposeDefault
- Indicates whether a default message should be composed if
the message can't be found in the resource bundle.
If composeDefault is false, this method will throw a MissingResourceException if the message could not be found.
If composeDefault is true, then if the message id is not found in the given bundle, this method composes and returns as helpful a message as possible in the format "UNKNOWN : [arg1], [arg2], ..."
private static int countParams(java.lang.String message)
public static java.lang.String composeDefaultMessage(java.lang.String message, java.lang.Object[] arguments)
message
- The message to start with, which often is nullarguments
- The arguments to the message.
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |