java.lang.Object
de.grogra.util.Configuration
- All Implemented Interfaces:
Map,ModifiableMap
A
Configuration is a ModifiableMap which uses
Strings 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
overridemethods. - The third level overrides the other levels, it is defined by the
putmethod.
- 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
ConstructorsConstructorDescriptionConfiguration(KeyDescription[] keys, Map values) Creates a newConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value associated withkey.voidOverrides default values of this configuration.voidoverrideIfUnset(String key, Object value) Sets a default value if no default value is provided by the map for default values.Mapskeytovalue.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:ModifiableMapMapskeytovalue. Following invocations of theget-method withkeyas key will returnvalue.- Specified by:
putin 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:MapReturns the value associated withkey. If there is no value associated withkey,defaultValueis returned. -
writeBack
public void writeBack()
-