org.apache.commons.i18n
Class XMLMessageProvider
java.lang.Object
org.apache.commons.i18n.XMLMessageProvider
- All Implemented Interfaces:
- MessageProvider
public class XMLMessageProvider
- extends java.lang.Object
- implements MessageProvider
The XMLMessageProvider
provides messages defined in an XML format.
Method Summary |
java.util.Map |
getEntries(java.lang.String id,
java.util.Locale locale)
|
java.lang.String |
getText(java.lang.String id,
java.lang.String entry,
java.util.Locale locale)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLMessageProvider
public XMLMessageProvider(java.io.InputStream inputStream)
getText
public java.lang.String getText(java.lang.String id,
java.lang.String entry,
java.util.Locale locale)
throws MessageNotFoundException
- Specified by:
getText
in interface MessageProvider
- Parameters:
id
- unique id that specifies a particular messageentry
- specifies a particular entry in the specified messagelocale
- the locale for which this text should be provided
- Returns:
- returns the localized message entry matching the given message id, entry key and locale. If
no match is found for the given locale, the parent locale is used, and finally the default. If the
id is found but the entry is not, null is returned.
- Throws:
MessageNotFoundException
- thrown if no message exists matching the given id
getEntries
public java.util.Map getEntries(java.lang.String id,
java.util.Locale locale)
throws MessageNotFoundException
- Specified by:
getEntries
in interface MessageProvider
- Parameters:
id
- unique id that specifies a particular messagelocale
- the locale for which to return the entries
- Returns:
- returns a map
<entry(String) -> localized text(String) of
message entries matching the given message id and locale
- Throws:
MessageNotFoundException
- thrown if no message could be found matching the given message id
Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.