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 ResourceBundle
ResourceBundle.Control -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilderAStringBuilderinstance containing all the paths of theResourceBundleinstances that have been merged into this instance.private StringThe location of the properties file that was used to instantiate theMultiPropertyResourceBundleinstance.AMapcontaining all the properties that have been merged from multipleResourceBundleinstances.Fields inherited from class 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 TypeMethodDescriptionbooleancontainsKey(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 theSetof keys from all merged bundleskeySet()Overrides the super class implementation to return theSetof keys from all merged bundlesvoidmerge(ResourceBundle resourceBundle, String resourcePath) Merges the properties of aResourceBundleinto the currentMultiPropertyResourceBundleinstance.Methods inherited from class ResourceBundle
clearCache, clearCache, getBaseBundleName, 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
MultiPropertyResourceBundleinstance. This field is set by the constructor. -
resources
A
Mapcontaining all the properties that have been merged from multipleResourceBundleinstances. -
mergedBundlePaths
A
StringBuilderinstance containing all the paths of theResourceBundleinstances 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 theclass.invalid reference
AbstractWebScript
-
-
Constructor Details
-
MultiPropertyResourceBundle
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
Constructor for instantiating from an existing
ResourceBundle. This calls themergemethod to copy the properties from the bundle into theresourcesmap.- Parameters:
baseBundle-resourcePath-
-
-
Method Details
-
getResourcePath
- Returns:
- The location of the properties file that was used to instantiate the
MultiPropertyResourceBundleinstance.
-
getMergedBundlePaths
- Returns:
- Returns the
StringBuilderinstance containing the paths of all theResourceBundleinstances that have been merged into this instance.
-
merge
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.resourcePath-
-
handleGetObject
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
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
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
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
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
-