public final class MessageService
extends java.lang.Object
It uses the resource bundle mechanism for locating messages based on keys; the preferred form of resource bundle is a property file mapping keys to messages.
Modifier and Type | Field | Description |
---|---|---|
private static java.util.Locale |
EN |
|
private static BundleFinder |
finder |
Modifier | Constructor | Description |
---|---|---|
private |
MessageService() |
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
formatMessage(java.util.ResourceBundle bundle,
java.lang.String messageId,
java.lang.Object[] arguments,
boolean lastChance) |
|
private static java.util.ResourceBundle |
getBundle(java.lang.String messageId) |
|
static java.util.ResourceBundle |
getBundleForLocale(java.util.Locale locale,
java.lang.String msgId) |
|
static java.util.ResourceBundle |
getBundleWithEnDefault(java.lang.String resource,
java.util.Locale locale) |
Method to use instead of ResourceBundle.getBundle().
|
static java.lang.String |
getProperty(java.lang.String messageId,
java.lang.String propertyName) |
|
static java.lang.String |
getTextMessage(java.lang.String messageId,
java.lang.Object... arguments) |
Transform the message from messageID to the actual error, warning, or
info message using the correct locale.
|
static int |
hashString50(java.lang.String key) |
Hash function to split messages into 50 files based
upon the message identifier or SQLState.
|
static void |
setFinder(BundleFinder theFinder) |
private static final java.util.Locale EN
private static BundleFinder finder
public static java.util.ResourceBundle getBundleForLocale(java.util.Locale locale, java.lang.String msgId)
public static void setFinder(BundleFinder theFinder)
public static java.lang.String getTextMessage(java.lang.String messageId, java.lang.Object... arguments)
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.
public static java.lang.String getProperty(java.lang.String messageId, java.lang.String propertyName)
public static java.lang.String formatMessage(java.util.ResourceBundle bundle, java.lang.String messageId, java.lang.Object[] arguments, boolean lastChance)
private static java.util.ResourceBundle getBundle(java.lang.String messageId)
public static java.util.ResourceBundle getBundleWithEnDefault(java.lang.String resource, java.util.Locale locale)
public static int hashString50(java.lang.String key)
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.