Class WebScriptPropertyResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- org.springframework.extensions.webscripts.WebScriptPropertyResourceBundle
-
public class WebScriptPropertyResourceBundle extends java.util.ResourceBundleExtends
PropertyResourceBundlein order to provide two 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.The rational of these capabilities is to allow a
WebScriptto locate and merge extension module properties files.- Author:
- David Draper
-
-
Constructor Summary
Constructors Constructor Description WebScriptPropertyResourceBundle(java.io.InputStream stream, java.lang.String resourcePath)Instantiates a newWebScriptPropertyResourceBundle.WebScriptPropertyResourceBundle(java.util.ResourceBundle baseBundle, java.lang.String resourcePath)Constructor for instantiating from an existingResourceBundle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(java.lang.String key)Overrides the super class implementation to check the existence of a key across all merged bundlesjava.util.Enumeration<java.lang.String>getKeys()Overrides the super class implementation to return an enumeration of keys from all the merged bundlesjava.lang.StringBuildergetMergedBundlePaths()java.lang.StringgetResourcePath()java.lang.ObjecthandleGetObject(java.lang.String key)Overrides the super class implementation to return an object located in the merged bundlesprotected java.util.Set<java.lang.String>handleKeySet()Overrides the super class implementation to return theSetof keys from all merged bundlesjava.util.Set<java.lang.String>keySet()Overrides the super class implementation to return theSetof keys from all merged bundlesvoidmerge(java.lang.String bundlePath, java.util.ResourceBundle resourceBundle)Merges the properties of aResourceBundleinto the currentWebScriptPropertyResourceBundleinstance.
-
-
-
Constructor Detail
-
WebScriptPropertyResourceBundle
public WebScriptPropertyResourceBundle(java.io.InputStream stream, java.lang.String resourcePath) throws java.io.IOExceptionInstantiates a new
WebScriptPropertyResourceBundle.- Parameters:
stream- TheInputStreampassed on to the super class constructor.resourcePath- The location of the properties file used to create theInputStream- Throws:
java.io.IOException
-
WebScriptPropertyResourceBundle
public WebScriptPropertyResourceBundle(java.util.ResourceBundle baseBundle, java.lang.String resourcePath)Constructor for instantiating from an existing
ResourceBundle. This calls themergemethod to copy the properties from the bundle into theresourcesmap.- Parameters:
baseBundle- ResourceBundleresourcePath- String
-
-
Method Detail
-
getResourcePath
public java.lang.String getResourcePath()
- Returns:
- The location of the properties file that was used to instantiate the
WebScriptPropertyResourceBundleinstance.
-
getMergedBundlePaths
public java.lang.StringBuilder getMergedBundlePaths()
- Returns:
- Returns the
StringBuilderinstance containing the paths of all theResourceBundleinstances that have been merged into this instance.
-
merge
public void merge(java.lang.String bundlePath, java.util.ResourceBundle resourceBundle)Merges the properties of a
ResourceBundleinto the currentWebScriptPropertyResourceBundleinstance. This will override any values mapped to duplicate keys in the current merged properties.- Parameters:
resourceBundle- TheResourceBundleto merge the properties of.
-
handleGetObject
public java.lang.Object handleGetObject(java.lang.String key)
Overrides the super class implementation to return an object located in the merged bundles
- Specified by:
handleGetObjectin classjava.util.ResourceBundle- Returns:
- An
Objectfrom the merged bundles
-
getKeys
public java.util.Enumeration<java.lang.String> getKeys()
Overrides the super class implementation to return an enumeration of keys from all the merged bundles
- Specified by:
getKeysin classjava.util.ResourceBundle- Returns:
- An
Enumerationof the keys across all the merged bundles.
-
handleKeySet
protected java.util.Set<java.lang.String> handleKeySet()
Overrides the super class implementation to return the
Setof keys from all merged bundles- Overrides:
handleKeySetin classjava.util.ResourceBundle- Returns:
- A
Setof keys obtained from all merged bundles
-
containsKey
public boolean containsKey(java.lang.String key)
Overrides the super class implementation to check the existence of a key across all merged bundles
- Overrides:
containsKeyin classjava.util.ResourceBundle- Returns:
trueif the key is present andfalseotherwise.
-
keySet
public java.util.Set<java.lang.String> keySet()
Overrides the super class implementation to return the
Setof keys from all merged bundles- Overrides:
keySetin classjava.util.ResourceBundle- Returns:
- A
Setof keys obtained from all merged bundles
-
-