Class MultiPropertyResourceBundle
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilder
AStringBuilder
instance containing all the paths of theResourceBundle
instances that have been merged into this instance.private String
The location of the properties file that was used to instantiate theMultiPropertyResourceBundle
instance.AMap
containing all the properties that have been merged from multipleResourceBundle
instances.Fields inherited from class java.util.ResourceBundle
parent
-
Constructor Summary
ConstructorsConstructorDescriptionMultiPropertyResourceBundle
(InputStream stream, String resourcePath) Instantiates a newMultiPropertyResourceBundle
.MultiPropertyResourceBundle
(ResourceBundle baseBundle, String resourcePath) Constructor for instantiating from an existingResourceBundle
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(String key) Overrides the super class implementation to check the existence of a key across all merged bundlesgetKeys()
Overrides the super class implementation to return an enumeration of keys from all the merged bundleshandleGetObject
(String key) Overrides the super class implementation to return an object located in the merged bundlesOverrides the super class implementation to return theSet
of keys from all merged bundleskeySet()
Overrides the super class implementation to return theSet
of keys from all merged bundlesvoid
merge
(ResourceBundle resourceBundle, String resourcePath) Merges the properties of aResourceBundle
into the currentMultiPropertyResourceBundle
instance.Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent
-
Field Details
-
resourcePath
The location of the properties file that was used to instantiate the
MultiPropertyResourceBundle
instance. This field is set by the constructor. -
resources
A
Map
containing all the properties that have been merged from multipleResourceBundle
instances. -
mergedBundlePaths
A
StringBuilder
instance containing all the paths of theResourceBundle
instances that have been merged into this instance. This value is intended to be use to help generate a key for caching JSON formatted resource output in theinvalid reference
AbstractWebScript
-
-
Constructor Details
-
MultiPropertyResourceBundle
Instantiates a new
MultiPropertyResourceBundle
.- Parameters:
stream
- TheInputStream
passed on to the super class constructor.resourcePath
- The location of the properties file used to create theInputStream
- Throws:
IOException
-
MultiPropertyResourceBundle
Constructor for instantiating from an existing
ResourceBundle
. This calls themerge
method to copy the properties from the bundle into theresources
map.- Parameters:
baseBundle
-resourcePath
-
-
-
Method Details
-
getResourcePath
- Returns:
- The location of the properties file that was used to instantiate the
MultiPropertyResourceBundle
instance.
-
getMergedBundlePaths
- Returns:
- Returns the
StringBuilder
instance containing the paths of all theResourceBundle
instances that have been merged into this instance.
-
merge
Merges the properties of a
ResourceBundle
into the currentMultiPropertyResourceBundle
instance. This will override any values mapped to duplicate keys in the current merged properties.- Parameters:
resourceBundle
- TheResourceBundle
to merge the properties of.resourcePath
-
-
handleGetObject
Overrides the super class implementation to return an object located in the merged bundles
- Specified by:
handleGetObject
in classResourceBundle
- Returns:
- An
Object
from the merged bundles
-
getKeys
Overrides the super class implementation to return an enumeration of keys from all the merged bundles
- Specified by:
getKeys
in classResourceBundle
- Returns:
- An
Enumeration
of the keys across all the merged bundles.
-
handleKeySet
Overrides the super class implementation to return the
Set
of keys from all merged bundles- Overrides:
handleKeySet
in classResourceBundle
- Returns:
- A
Set
of keys obtained from all merged bundles
-
containsKey
Overrides the super class implementation to check the existence of a key across all merged bundles
- Overrides:
containsKey
in classResourceBundle
- Returns:
true
if the key is present andfalse
otherwise.
-
keySet
Overrides the super class implementation to return the
Set
of keys from all merged bundles- Overrides:
keySet
in classResourceBundle
- Returns:
- A
Set
of keys obtained from all merged bundles
-