Class HashMapResourceBundle


  • public class HashMapResourceBundle
    extends java.util.ResourceBundle
    A resource bundle backed by a hash map.
    Author:
    Garret Wilson
    See Also:
    PropertyResourceBundle
    • 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
      HashMapResourceBundle()
      Default constructor with no parent using a hash map.
      HashMapResourceBundle​(java.util.Map<?,​?> map)
      Map constructor with no parent.
      HashMapResourceBundle​(java.util.Map<?,​?> map, java.util.ResourceBundle parent)
      Map and parent constructor.
      HashMapResourceBundle​(java.util.ResourceBundle parent)
      Parent constructor using a hash map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Enumeration<java.lang.String> getKeys()  
      protected java.lang.Object handleGetObject​(java.lang.String key)
      Gets an object for the given key from this resource bundle.
      • Methods inherited from class java.util.ResourceBundle

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

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

      • HashMapResourceBundle

        public HashMapResourceBundle()
        Default constructor with no parent using a hash map.
      • HashMapResourceBundle

        public HashMapResourceBundle​(java.util.ResourceBundle parent)
        Parent constructor using a hash map.
        Parameters:
        parent - The parent resource bundle, or null if there should be no parent for resolving resources.
      • HashMapResourceBundle

        public HashMapResourceBundle​(java.util.Map<?,​?> map)
        Map constructor with no parent. Keys will be converted to strings.
        Parameters:
        map - The map containing the resource mappings which will be copied to this map.
        Throws:
        java.lang.NullPointerException - if the given map is null.
      • HashMapResourceBundle

        public HashMapResourceBundle​(java.util.Map<?,​?> map,
                                     java.util.ResourceBundle parent)
        Map and parent constructor. All values will be copied to the map. Keys will be converted to strings.
        Parameters:
        map - The map containing the resource mappings which will be copied to this map.
        parent - The parent resource bundle, or null if there should be no parent for resolving resources.
        Throws:
        java.lang.NullPointerException - if the given map is null.
    • Method Detail

      • handleGetObject

        protected java.lang.Object handleGetObject​(java.lang.String key)
        Gets an object for the given key from this resource bundle.
        Specified by:
        handleGetObject in class java.util.ResourceBundle
        Parameters:
        key - The key for the desired object.
        Returns:
        The object for the given key, or null.
        Throws:
        java.lang.NullPointerException - if the given key is null.
      • getKeys

        public java.util.Enumeration<java.lang.String> getKeys()
        Specified by:
        getKeys in class java.util.ResourceBundle
        Returns:
        An enumeration of the resource keys.