Class MultiPropertyResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- tech.units.indriya.internal.format.l10n.MultiPropertyResourceBundle
-
public class MultiPropertyResourceBundle extends ResourceBundle
ExtendsResourceBundlewith 2 new capabilities. The first is to store the path where the properties file used to create theInputStreamis located and the second is to allow additionalResourceBundleproperties to be merged into an instance.To allow a
SystemOfUnitsto locate and merge extension module properties files.- Version:
- 1.0
- Author:
- Werner Keil
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
-
Field Summary
-
Fields inherited from class java.util.ResourceBundle
parent
-
-
Constructor Summary
Constructors Constructor Description MultiPropertyResourceBundle(InputStream stream, String resourcePath)Instantiates a newMultiPropertyResourceBundle.MultiPropertyResourceBundle(ResourceBundle baseBundle, String resourcePath)Constructor for instantiating from an existingResourceBundle.
-
Method Summary
Modifier and Type Method Description booleancontainsKey(String key)Overrides the super class implementation to check the existence of a key across all merged bundlesEnumeration<String>getKeys()Overrides the super class implementation to return an enumeration of keys from all the merged bundlesStringBuildergetMergedBundlePaths()StringgetResourcePath()ObjecthandleGetObject(String key)Overrides the super class implementation to return an object located in the merged bundlesprotected Set<String>handleKeySet()Overrides the super class implementation to return theSetof keys from all merged bundlesSet<String>keySet()Overrides the super class implementation to return theSetof keys from all merged bundlesvoidmerge(ResourceBundle resourceBundle, String aResourcePath)Merges the properties of aResourceBundleinto the currentMultiPropertyResourceBundleinstance.-
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent
-
-
-
-
Constructor Detail
-
MultiPropertyResourceBundle
public MultiPropertyResourceBundle(InputStream stream, String resourcePath) throws IOException
Instantiates a new
MultiPropertyResourceBundle.- Parameters:
stream- TheInputStreampassed on to the super class constructor.resourcePath- The location of the properties file used to create theInputStream- Throws:
IOException
-
MultiPropertyResourceBundle
public MultiPropertyResourceBundle(ResourceBundle baseBundle, String resourcePath)
Constructor for instantiating from an existing
ResourceBundle. This calls themergemethod to copy the properties from the bundle into theresourcesmap.- Parameters:
baseBundle-resourcePath-
-
-
Method Detail
-
getResourcePath
public String getResourcePath()
- Returns:
- The location of the properties file that was used to instantiate the
MultiPropertyResourceBundleinstance.
-
getMergedBundlePaths
public StringBuilder getMergedBundlePaths()
- Returns:
- Returns the
StringBuilderinstance containing the paths of all theResourceBundleinstances that have been merged into this instance.
-
merge
public void merge(ResourceBundle resourceBundle, String aResourcePath)
Merges the properties of a
ResourceBundleinto the currentMultiPropertyResourceBundleinstance. This will override any values mapped to duplicate keys in the current merged properties.- Parameters:
resourceBundle- TheResourceBundleto merge the properties of.aResourcePath-
-
handleGetObject
public Object handleGetObject(String key)
Overrides the super class implementation to return an object located in the merged bundles
- Specified by:
handleGetObjectin classResourceBundle- Returns:
- An
Objectfrom the merged bundles
-
getKeys
public Enumeration<String> getKeys()
Overrides the super class implementation to return an enumeration of keys from all the merged bundles
- Specified by:
getKeysin classResourceBundle- Returns:
- An
Enumerationof the keys across all the merged bundles.
-
handleKeySet
protected Set<String> handleKeySet()
Overrides the super class implementation to return the
Setof keys from all merged bundles- Overrides:
handleKeySetin classResourceBundle- Returns:
- A
Setof keys obtained from all merged bundles
-
containsKey
public boolean containsKey(String key)
Overrides the super class implementation to check the existence of a key across all merged bundles
- Overrides:
containsKeyin classResourceBundle- Returns:
trueif the key is present andfalseotherwise.
-
keySet
public Set<String> keySet()
Overrides the super class implementation to return the
Setof keys from all merged bundles- Overrides:
keySetin classResourceBundle- Returns:
- A
Setof keys obtained from all merged bundles
-
-