Class ResourceBundleMessageProvider

  extended by org.apache.commons.i18n.ResourceBundleMessageProvider
All Implemented Interfaces:

public class ResourceBundleMessageProvider
extends java.lang.Object
implements MessageProvider

The ResourceBundleMessageProvider deals with messages defined in resource bundles. Messages defined in resource bundles can be grouped together by adding the entry key at the end of the message key separated by a dot.

Constructor Summary
ResourceBundleMessageProvider(java.lang.String baseName)
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

Constructor Detail


public ResourceBundleMessageProvider(java.lang.String baseName)
                              throws MessageNotFoundException
MessageNotFoundException - Thrown if the resource bundle does not exist.
Method Detail


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
id - unique id that specifies a particular message
entry - specifies a particular entry in the specified message
locale - the locale for which this text should be provided
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.
MessageNotFoundException - thrown if no message exists matching the given id


public java.util.Map getEntries(java.lang.String id,
                                java.util.Locale locale)
Specified by:
getEntries in interface MessageProvider
id - unique id that specifies a particular message
locale - the locale for which to return the entries
returns a map <entry(String) -> localized text(String) of message entries matching the given message id and locale

Copyright 2004-2008 The Apache Software Foundation. All Rights Reserved.