|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.zphinx.spine.message.SpineMessageManager
public class SpineMessageManager
SpineMessageManager is a minimal implementation of the apache I18N MessageManager object. It provides the base methods needed by spine and adds extra functionality to the MessageManager Object.
It also contains bug fixes for errors found in MessageManager
Copyright ©Zphinx Software Solutions
Field Summary | |
---|---|
(package private) static String |
INTERNAL_MESSAGE_NOT_FOUND
|
(package private) static String |
MESSAGE_ENTRY_NOT_FOUND
|
(package private) static String |
MESSAGE_NOT_FOUND
|
(package private) static String |
NO_MESSAGE_ENTRIES_FOUND
|
(package private) static String |
RESOURCE_BUNDLE_NOT_FOUND
|
Method Summary | |
---|---|
static void |
addMessageProvider(String providerId,
org.apache.commons.i18n.MessageProvider messageProvider)
Add a custom to the MessageManager . |
static Map |
getEntries(String id,
Locale locale)
Returns a map containing all available message entries for the given locale. |
static Map |
getEntries(String providerId,
String id,
Locale locale)
Returns a map containing all available message entries in the stated provider, for the given locale. |
static String |
getText(String providerId,
String id,
String entry,
Object[] arguments,
Locale locale)
Tries to find the desired entry in the named message provider. |
static String |
getText(String providerId,
String id,
String entry,
Object[] arguments,
Locale locale,
String defaultText)
Attempts to find the requested message from the registered message provider in order to find the given entry in the requested message bundle. |
static void |
removeMessageProvider(String providerId)
Remove custom from the MessageManager . |
static String |
searchMessages(String providerId,
String id,
String entry,
Object[] arguments,
Locale locale,
String defaultText)
This method first looks in the provider given for the occurence of the entry, then recursively searchs the other providers in the system for the key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final String INTERNAL_MESSAGE_NOT_FOUND
static final String MESSAGE_NOT_FOUND
static final String NO_MESSAGE_ENTRIES_FOUND
static final String MESSAGE_ENTRY_NOT_FOUND
static final String RESOURCE_BUNDLE_NOT_FOUND
Method Detail |
---|
public static void addMessageProvider(String providerId, org.apache.commons.i18n.MessageProvider messageProvider)
MessageProvider
to the MessageManager
. It will be incorporated in later calls of the getText
or getEntries
methods.
providerId
- Id of the provider used for uninstallation and qualified naming.messageProvider
- The MessageProvider
to be added.public static void removeMessageProvider(String providerId)
MessageProvider
from the MessageManager
. Used for tearing down unit tests.
providerId
- The ID of the provider to remove.public static String getText(String providerId, String id, String entry, Object[] arguments, Locale locale) throws org.apache.commons.i18n.MessageNotFoundException
providerId
- The name of the message provider (i.e. source) to use for the messageid
- The identifier that will be used to retrieve the message bundleentry
- The desired message entryarguments
- The dynamic parts of the message that will be evaluated using the standard java text formatting abilities.locale
- The locale in which the message will be printed
org.apache.commons.i18n.MessageNotFoundException
- Will be thrown if the requested message provider cannot be found or no message bundle can be found for the given id or if the desired message entry is missing in the retrieved bundlepublic static String getText(String providerId, String id, String entry, Object[] arguments, Locale locale, String defaultText)
providerId
- The name of the message provider (i.e. source) to use for the messageid
- The identifier that will be used to retrieve the message bundleentry
- The desired message entryarguments
- The dynamic parts of the message that will be evaluated using the standard java text formatting abilities.locale
- The locale in which the message will be printeddefaultText
- If no message bundle or message entry could be found for the specified parameters, the default text will be returned.
public static Map getEntries(String id, Locale locale) throws org.apache.commons.i18n.MessageNotFoundException
String
containing the keys of the available message entries and values of type String
containing the localized message entries.
available within all the message providers.
id
- The key to search for in this managerlocale
- The locale in which the entries are expected to be located
org.apache.commons.i18n.MessageNotFoundException
public static Map getEntries(String providerId, String id, Locale locale) throws org.apache.commons.i18n.MessageNotFoundException
String
containing the keys of the available message entries and values of type String
containing the localized message entries.
providerId
- The name of the message provider (i.e. source) to use for the messageid
- The identifier that will be used to retrieve the message bundlelocale
- The locale in which the message will be printed
org.apache.commons.i18n.MessageNotFoundException
public static String searchMessages(String providerId, String id, String entry, Object[] arguments, Locale locale, String defaultText) throws Throwable
providerId
- The name of the message provider (i.e. source) to use for the messageid
- The identifier that will be used to retrieve the message bundleentry
- The desired message entryarguments
- The dynamic parts of the message that will be evaluated using the standard java text formatting abilities.locale
- The locale in which the message will be printeddefaultText
- If no message bundle or message entry could be found for the specified parameters, the default text will be returned.
Throwable
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |