Class MapConfiguration
java.lang.Object
is.galia.config.MapConfiguration
- All Implemented Interfaces:
Configuration
Implementation backed by a Map
.
Mutability and thread safety are dictated by the backing map.
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes an instance with a new empty, mutable, thread-safe backing map.MapConfiguration
(Map<String, Object> backingMap) Enables the use of a custom backing map, essentially providing a facade to it. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears any key-value pairs from the instance (but not its persistent store, if available).void
clearProperty
(String key) Removes a single key-value pair from the instance (but not its persistent store, if available).boolean
getBoolean
(String key) boolean
getBoolean
(String key, boolean defaultValue) double
double
getFile()
float
float
int
int
getKeys()
long
long
getProperty
(String key) void
reload()
No-op.void
setProperty
(String key, Object value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface is.galia.config.Configuration
clearProperty, getBoolean, getBoolean, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getLongBytes, getLongBytes, getLongBytes, getLongBytes, getProperty, getString, getString, setProperty, toMap
-
Constructor Details
-
MapConfiguration
public MapConfiguration()Initializes an instance with a new empty, mutable, thread-safe backing map. -
MapConfiguration
-
-
Method Details
-
clear
public void clear()Description copied from interface:Configuration
Clears any key-value pairs from the instance (but not its persistent store, if available).- Specified by:
clear
in interfaceConfiguration
-
clearProperty
Description copied from interface:Configuration
Removes a single key-value pair from the instance (but not its persistent store, if available).- Specified by:
clearProperty
in interfaceConfiguration
- Parameters:
key
- Key to remove.
-
getBackingMap
-
getBoolean
- Specified by:
getBoolean
in interfaceConfiguration
-
getBoolean
- Specified by:
getBoolean
in interfaceConfiguration
- Returns:
- Boolean value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a boolean.
-
getDouble
- Specified by:
getDouble
in interfaceConfiguration
-
getDouble
- Specified by:
getDouble
in interfaceConfiguration
- Returns:
- Double value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a double.
-
getFile
- Specified by:
getFile
in interfaceConfiguration
- Returns:
- The file backing the instance, if any.
-
getFloat
- Specified by:
getFloat
in interfaceConfiguration
-
getFloat
- Specified by:
getFloat
in interfaceConfiguration
- Returns:
- Float value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a float.
-
getInt
- Specified by:
getInt
in interfaceConfiguration
-
getInt
- Specified by:
getInt
in interfaceConfiguration
- Returns:
- Int value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to an int.
-
getKeys
- Specified by:
getKeys
in interfaceConfiguration
- Returns:
- All keys contained in the configuration.
-
getLong
- Specified by:
getLong
in interfaceConfiguration
-
getLong
- Specified by:
getLong
in interfaceConfiguration
- Returns:
- Long value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a long.
-
getProperty
- Specified by:
getProperty
in interfaceConfiguration
- Returns:
- Object value corresponding to the given key, or
null
if not set.
-
getString
- Specified by:
getString
in interfaceConfiguration
- Returns:
- String value corresponding to the given key, or
null
if not set.
-
getString
- Specified by:
getString
in interfaceConfiguration
- Returns:
- String value corresponding to the given key, or the given default value if the target value is null.
-
reload
-
setProperty
- Specified by:
setProperty
in interfaceConfiguration
-