Package com.globalmentor.util
Class HashMapResourceBundle
java.lang.Object
java.util.ResourceBundle
com.globalmentor.util.HashMapResourceBundle
A resource bundle backed by a hash map.
- Author:
- Garret Wilson
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
Field Summary
Fields inherited from class java.util.ResourceBundle
parent
-
Constructor Summary
ConstructorDescriptionDefault constructor with no parent using a hash map.HashMapResourceBundle
(Map<?, ?> map) Map constructor with no parent.HashMapResourceBundle
(Map<?, ?> map, ResourceBundle parent) Map and parent constructor.HashMapResourceBundle
(ResourceBundle parent) Parent constructor using a hash map. -
Method Summary
Modifier and TypeMethodDescriptiongetKeys()
protected Object
handleGetObject
(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, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParent
-
Constructor Details
-
HashMapResourceBundle
public HashMapResourceBundle()Default constructor with no parent using a hash map. -
HashMapResourceBundle
Parent constructor using a hash map.- Parameters:
parent
- The parent resource bundle, ornull
if there should be no parent for resolving resources.
-
HashMapResourceBundle
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:
NullPointerException
- if the given map isnull
.
-
HashMapResourceBundle
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:
NullPointerException
- if the given map isnull
.
-
-
Method Details
-
handleGetObject
Gets an object for the given key from this resource bundle.- Specified by:
handleGetObject
in classResourceBundle
- Parameters:
key
- The key for the desired object.- Returns:
- The object for the given key, or
null
. - Throws:
NullPointerException
- if the given key isnull
.
-
getKeys
- Specified by:
getKeys
in classResourceBundle
- Returns:
- An enumeration of the resource keys.
-