Package com.globalmentor.util
Class HashMapResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- com.globalmentor.util.HashMapResourceBundle
-
public class HashMapResourceBundle extends java.util.ResourceBundle
A resource bundle backed by a hash map.- Author:
- Garret Wilson
- See Also:
PropertyResourceBundle
-
-
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.
-
-
-
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, ornull
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 isnull
.
-
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, ornull
if there should be no parent for resolving resources.- Throws:
java.lang.NullPointerException
- if the given map isnull
.
-
-
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 classjava.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 isnull
.
-
getKeys
public java.util.Enumeration<java.lang.String> getKeys()
- Specified by:
getKeys
in classjava.util.ResourceBundle
- Returns:
- An enumeration of the resource keys.
-
-