public class MultiPropertyResourceBundle extends ResourceBundle
ResourceBundle
with 2 new capabilities. The first is to store the path where the properties file used to create the
InputStream
is located and the second is to allow additional ResourceBundle
properties to be merged into an instance.
To allow a SystemOfUnits
to locate and merge extension module properties files.
ResourceBundle.Control
parent
Constructor and Description |
---|
MultiPropertyResourceBundle(InputStream stream,
String resourcePath)
Instantiates a new
MultiPropertyResourceBundle . |
MultiPropertyResourceBundle(ResourceBundle baseBundle,
String resourcePath)
Constructor for instantiating from an existing
ResourceBundle . |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Overrides the super class implementation to check the existence of a key across all merged bundles
|
Enumeration<String> |
getKeys()
Overrides the super class implementation to return an enumeration of keys from all the merged bundles
|
StringBuilder |
getMergedBundlePaths() |
String |
getResourcePath() |
Object |
handleGetObject(String key)
Overrides the super class implementation to return an object located in the merged bundles
|
protected Set<String> |
handleKeySet()
Overrides the super class implementation to return the
Set of keys from all merged bundles |
Set<String> |
keySet()
Overrides the super class implementation to return the
Set of keys from all merged bundles |
void |
merge(ResourceBundle resourceBundle,
String resourcePath)
Merges the properties of a
ResourceBundle into the current MultiPropertyResourceBundle instance. |
clearCache, clearCache, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent
public MultiPropertyResourceBundle(InputStream stream, String resourcePath) throws IOException
Instantiates a new MultiPropertyResourceBundle
.
stream
- The InputStream
passed on to the super class constructor.resourcePath
- The location of the properties file used to create the InputStream
IOException
public MultiPropertyResourceBundle(ResourceBundle baseBundle, String resourcePath)
Constructor for instantiating from an existing ResourceBundle
. This calls the merge
method to copy the properties from the
bundle into the resources
map.
baseBundle
- resourcePath
- public String getResourcePath()
MultiPropertyResourceBundle
instance.public StringBuilder getMergedBundlePaths()
StringBuilder
instance containing the paths of all the ResourceBundle
instances that have been merged into
this instance.public void merge(ResourceBundle resourceBundle, String resourcePath)
Merges the properties of a ResourceBundle
into the current MultiPropertyResourceBundle
instance. This will override any
values mapped to duplicate keys in the current merged properties.
resourceBundle
- The ResourceBundle
to merge the properties of.resourcePath
- public Object handleGetObject(String key)
Overrides the super class implementation to return an object located in the merged bundles
handleGetObject
in class ResourceBundle
Object
from the merged bundlespublic Enumeration<String> getKeys()
Overrides the super class implementation to return an enumeration of keys from all the merged bundles
getKeys
in class ResourceBundle
Enumeration
of the keys across all the merged bundles.protected Set<String> handleKeySet()
Overrides the super class implementation to return the Set
of keys from all merged bundles
handleKeySet
in class ResourceBundle
Set
of keys obtained from all merged bundlespublic boolean containsKey(String key)
Overrides the super class implementation to check the existence of a key across all merged bundles
containsKey
in class ResourceBundle
true
if the key is present and false
otherwise.public Set<String> keySet()
Overrides the super class implementation to return the Set
of keys from all merged bundles
keySet
in class ResourceBundle
Set
of keys obtained from all merged bundlesCopyright © 2005-2021 Units of Measurement project. All Rights Reserved.