public class ResourceBundleManager extends Object
Manage a set of resource bundles. Obtention of bundles is delegated to a ResourceBundleFactory. A bundle obtained successfully is cached in order to avoid the potential expensive cost of the bundle retrieval.
The manager can also be used to build LocalizedString object from the loaded bundles.
| Constructor and Description |
|---|
ResourceBundleManager(ResourceBundle defaultBundle,
org.gatein.common.i18n.ResourceBundleFactory resourceBundleFactory) |
| Modifier and Type | Method and Description |
|---|---|
org.gatein.common.i18n.LocalizedString |
getLocalizedValue(String key,
String defaultValue)
Return a localized value constructed from the various resource bundles.
|
ResourceBundle |
getResourceBundle(Locale locale)
Return a bundle for the given locale.
|
public ResourceBundleManager(ResourceBundle defaultBundle, org.gatein.common.i18n.ResourceBundleFactory resourceBundleFactory) throws IllegalArgumentException
defaultBundle - the default bundle returned when no bundle has been obtained for the localeresourceBundleFactory - the resource bundle factoryIllegalArgumentException - IllegalArgumentException if the resource bundle factory is nullpublic org.gatein.common.i18n.LocalizedString getLocalizedValue(String key, String defaultValue) throws IllegalArgumentException
Locale.ENGLISH. Two successive calls to this method may not return identical results since the
returned LocalizedString is built using the bundles known by the manager.key - the key to lookup in the bundlesdefaultValue - the default valueIllegalArgumentException - if the key of the default value is nullpublic ResourceBundle getResourceBundle(Locale locale) throws IllegalArgumentException
locale - the locale we want a bundle forIllegalArgumentException - if the locale is nullCopyright © 2003-2019 GateIn. All Rights Reserved.