public class BundleMessage extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
BundleMessage.BundleMessageList
Typed bundle message collection
|
Modifier and Type | Field and Description |
---|---|
protected String |
key |
protected static String |
MESSAGE_BUNDLE_NAME |
static Locale |
ROOT_LOCALE
Root locale to get english messages for logging.
|
Constructor and Description |
---|
BundleMessage(String key,
Object... arguments)
Internationalization message.
|
Modifier and Type | Method and Description |
---|---|
String |
format()
Format message with the default locale.
|
String |
format(Locale locale)
Format message with the given locale.
|
static String |
format(Locale locale,
String key,
Object... arguments)
Get formatted message for message key and values with the given locale.
|
static String |
format(String key,
Object... arguments)
Get formatted message for message key and values with the default locale.
|
String |
formatLog()
Format message for logging (with the root locale).
|
static String |
formatLog(String key,
Object... arguments)
Get formatted log message for message key and values.
|
protected static ResourceBundle |
getBundle(Locale locale)
Get bundle for the given locale.
|
static String |
getExceptionLogMessage(BundleMessage message,
Exception e)
Get formatted error message for bundle message and exception for logging.
|
static String |
getExceptionMessage(BundleMessage message,
Exception e)
Get formatted error message for bundle message and exception with default locale.
|
static String |
getExceptionMessage(BundleMessage message,
Exception e,
Locale locale)
Get formatted error message for bundle message and exception with given locale.
|
String |
toString()
Format message for logging (with the root locale).
|
public static final Locale ROOT_LOCALE
protected static final String MESSAGE_BUNDLE_NAME
protected final String key
public String format()
public String format(Locale locale)
locale
- resource bundle localepublic String formatLog()
public String toString()
protected static ResourceBundle getBundle(Locale locale)
locale
- resource bundle localepublic static String format(String key, Object... arguments)
key
- message key in resource bundlearguments
- message valuespublic static String format(Locale locale, String key, Object... arguments)
locale
- resource bundle localekey
- message key in resource bundlearguments
- message valuespublic static String formatLog(String key, Object... arguments)
key
- message key in resource bundlearguments
- message valuespublic static String getExceptionLogMessage(BundleMessage message, Exception e)
message
- bundle messagee
- exceptionpublic static String getExceptionMessage(BundleMessage message, Exception e)
message
- bundle messagee
- exceptionpublic static String getExceptionMessage(BundleMessage message, Exception e, Locale locale)
message
- bundle messagee
- exceptionlocale
- bundle localeCopyright © 2001–2024 MickaĆ«l Guessant. All rights reserved.