Class WebScriptPropertyResourceBundle


  • public class WebScriptPropertyResourceBundle
    extends java.util.ResourceBundle

    Extends PropertyResourceBundle in order to provide two 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.

    The rational of these capabilities is to allow a WebScript to locate and merge extension module properties files.

    Author:
    David Draper
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.ResourceBundle

        java.util.ResourceBundle.Control
    • Field Summary

      • Fields inherited from class java.util.ResourceBundle

        parent
    • Constructor Summary

      Constructors 
      Constructor Description
      WebScriptPropertyResourceBundle​(java.io.InputStream stream, java.lang.String resourcePath)
      Instantiates a new WebScriptPropertyResourceBundle.
      WebScriptPropertyResourceBundle​(java.util.ResourceBundle baseBundle, java.lang.String resourcePath)
      Constructor for instantiating from an existing ResourceBundle.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.String key)
      Overrides the super class implementation to check the existence of a key across all merged bundles
      java.util.Enumeration<java.lang.String> getKeys()
      Overrides the super class implementation to return an enumeration of keys from all the merged bundles
      java.lang.StringBuilder getMergedBundlePaths()  
      java.lang.String getResourcePath()  
      java.lang.Object handleGetObject​(java.lang.String key)
      Overrides the super class implementation to return an object located in the merged bundles
      protected java.util.Set<java.lang.String> handleKeySet()
      Overrides the super class implementation to return the Set of keys from all merged bundles
      java.util.Set<java.lang.String> keySet()
      Overrides the super class implementation to return the Set of keys from all merged bundles
      void merge​(java.lang.String bundlePath, java.util.ResourceBundle resourceBundle)
      Merges the properties of a ResourceBundle into the current WebScriptPropertyResourceBundle instance.
      • Methods inherited from class java.util.ResourceBundle

        clearCache, clearCache, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WebScriptPropertyResourceBundle

        public WebScriptPropertyResourceBundle​(java.io.InputStream stream,
                                               java.lang.String resourcePath)
                                        throws java.io.IOException

        Instantiates a new WebScriptPropertyResourceBundle.

        Parameters:
        stream - The InputStream passed on to the super class constructor.
        resourcePath - The location of the properties file used to create the InputStream
        Throws:
        java.io.IOException
      • WebScriptPropertyResourceBundle

        public WebScriptPropertyResourceBundle​(java.util.ResourceBundle baseBundle,
                                               java.lang.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.

        Parameters:
        baseBundle - ResourceBundle
        resourcePath - String
    • Method Detail

      • getResourcePath

        public java.lang.String getResourcePath()
        Returns:
        The location of the properties file that was used to instantiate the WebScriptPropertyResourceBundle instance.
      • getMergedBundlePaths

        public java.lang.StringBuilder getMergedBundlePaths()
        Returns:
        Returns the StringBuilder instance containing the paths of all the ResourceBundle instances that have been merged into this instance.
      • merge

        public void merge​(java.lang.String bundlePath,
                          java.util.ResourceBundle resourceBundle)

        Merges the properties of a ResourceBundle into the current WebScriptPropertyResourceBundle instance. This will override any values mapped to duplicate keys in the current merged properties.

        Parameters:
        resourceBundle - The ResourceBundle to 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:
        handleGetObject in class java.util.ResourceBundle
        Returns:
        An Object from 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:
        getKeys in class java.util.ResourceBundle
        Returns:
        An Enumeration of the keys across all the merged bundles.
      • handleKeySet

        protected java.util.Set<java.lang.String> handleKeySet()

        Overrides the super class implementation to return the Set of keys from all merged bundles

        Overrides:
        handleKeySet in class java.util.ResourceBundle
        Returns:
        A Set of 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:
        containsKey in class java.util.ResourceBundle
        Returns:
        true if the key is present and false otherwise.
      • keySet

        public java.util.Set<java.lang.String> keySet()

        Overrides the super class implementation to return the Set of keys from all merged bundles

        Overrides:
        keySet in class java.util.ResourceBundle
        Returns:
        A Set of keys obtained from all merged bundles