java.lang.Object
de.grogra.util.Configuration
- All Implemented Interfaces:
Map
,ModifiableMap
A
Configuration
is a ModifiableMap
which uses
String
s as keys and maintains three levels of associations:
- The basic level is represented by default values and is not modified by methods of this class.
- The next level overrides the basic level, it is defined by
the
override
methods. - The third level overrides the other levels, it is defined by the
put
method.
- Author:
- Ole Kniemeyer
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.grogra.util.ModifiableMap
ModifiableMap.Producer
-
Field Summary
Fields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAP
-
Constructor Summary
ConstructorDescriptionConfiguration
(KeyDescription[] keys, Map values) Creates a newConfiguration
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value associated withkey
.void
Overrides default values of this configuration.void
overrideIfUnset
(String key, Object value) Sets a default value if no default value is provided by the map for default values.Mapskey
tovalue
.void
-
Constructor Details
-
Configuration
Creates a newConfiguration
. Its keys are described bykeys
, its default values by the mapvalues
.- Parameters:
keys
- the keys of this configurationvalues
- the default values of this configuration
-
-
Method Details
-
put
Description copied from interface:ModifiableMap
Mapskey
tovalue
. Following invocations of theget
-method withkey
as key will returnvalue
.- Specified by:
put
in interfaceModifiableMap
- Parameters:
key
- a keyvalue
- the value to be associated withkey
- Returns:
- the previously associated value, or
null
-
override
Overrides default values of this configuration.- Parameters:
key
- a keyvalue
- the new default value forkey
-
overrideIfUnset
Sets a default value if no default value is provided by the map for default values.- Parameters:
key
- a keyvalue
- the default value forkey
-
get
Description copied from interface:Map
Returns the value associated withkey
. If there is no value associated withkey
,defaultValue
is returned. -
writeBack
public void writeBack()
-