public class CompositeResourceBundle
extends java.util.ResourceBundle
ResourceBundle which is a composition of two or more decorated bundles. Generally a ResourceBundle
already can manage an internal parent bundle. In that case whenever a PropertyResourceBundle is
created the parent bundle is set according specified language, country etc. However disadvantage is that fallback
options can't be specified and parent bundles can't be set manually.ResourceBundle allows free choice of parent bundles as well as control over events,
when the fallback bundle shall be used (e.g. when key exists but value is empty).| Modifier and Type | Field and Description |
|---|---|
static int |
KEY_FALLBACK |
static int |
KEY_VALUE_FALLBACK |
static int |
VALUE_FALLBACK |
| Constructor and Description |
|---|
CompositeResourceBundle(java.util.Collection<java.util.ResourceBundle> bundles)
Constructor.
|
CompositeResourceBundle(java.util.Collection<java.util.ResourceBundle> bundles,
int fallback)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.ResourceBundle |
getBundle(java.util.Collection<java.util.ResourceBundle> bundles) |
static java.util.ResourceBundle |
getBundle(java.lang.String baseName,
java.util.Locale[] locales)
Similar to
ResourceBundle.getBundle(String, Locale) except that multiple Locales can be given to enable
fallback strategies. |
static java.util.ResourceBundle |
getBundle(java.lang.String baseName,
java.util.Locale[] locales,
java.lang.ClassLoader loader)
Similar to
ResourceBundle.getBundle(String, Locale, ClassLoader) except that multiple Locales can be given
to enable fallback strategies. |
protected java.util.Collection<java.util.ResourceBundle> |
getBundlesInternal() |
java.util.Enumeration<java.lang.String> |
getKeys() |
protected java.lang.Object |
handleGetObject(java.lang.String key)
Internal.
Processes fallback strategies. |
boolean |
isKeyFallbackEnabled()
Returns whether key fallback is enabled.
|
boolean |
isValueFallbackEnabled()
Returns whether key fallback is enabled.
|
public static final int KEY_FALLBACK
public static final int VALUE_FALLBACK
public static final int KEY_VALUE_FALLBACK
public CompositeResourceBundle(java.util.Collection<java.util.ResourceBundle> bundles)
bundles - collection of ResourceBundle which are used to compose this bundlepublic CompositeResourceBundle(java.util.Collection<java.util.ResourceBundle> bundles,
int fallback)
bundles - collection of ResourceBundle which are used to compose this bundlefallback - fallback optionspublic boolean isKeyFallbackEnabled()
public boolean isValueFallbackEnabled()
protected java.util.Collection<java.util.ResourceBundle> getBundlesInternal()
public java.util.Enumeration<java.lang.String> getKeys()
getKeys in class java.util.ResourceBundleprotected java.lang.Object handleGetObject(java.lang.String key)
handleGetObject in class java.util.ResourceBundlekey - ressourcebundle keypublic static java.util.ResourceBundle getBundle(java.lang.String baseName,
java.util.Locale[] locales)
ResourceBundle.getBundle(String, Locale) except that multiple Locales can be given to enable
fallback strategies.baseName - locales - ResourceBundlepublic static java.util.ResourceBundle getBundle(java.lang.String baseName,
java.util.Locale[] locales,
java.lang.ClassLoader loader)
ResourceBundle.getBundle(String, Locale, ClassLoader) except that multiple Locales can be given
to enable fallback strategies.baseName - locales - loader - public static java.util.ResourceBundle getBundle(java.util.Collection<java.util.ResourceBundle> bundles)
bundles - the collection of bundles. Fallback strategies are provided via order of these resource bundles.ResourceBundleCopyright © 2018 SAP SE. All Rights Reserved.