public class MapSettings extends Settings
Settings
. It must be used
only for unit tests. This is not the implementation
deployed at runtime, so non-test code must never cast
Settings
to MapSettings
.Constructor and Description |
---|
MapSettings() |
MapSettings(PropertyDefinitions definitions) |
Modifier and Type | Method and Description |
---|---|
Configuration |
asConfig() |
MapSettings |
clear()
Delete all properties
|
protected java.util.Optional<java.lang.String> |
get(java.lang.String key) |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Immutable map of the properties that have non-default values.
|
protected void |
remove(java.lang.String key) |
protected void |
set(java.lang.String key,
java.lang.String value)
Add the settings with the specified key and value, both are trimmed and neither can be null.
|
MapSettings |
setProperty(java.lang.String key,
java.lang.Boolean value) |
MapSettings |
setProperty(java.lang.String key,
java.lang.Integer value) |
MapSettings |
setProperty(java.lang.String key,
java.lang.Long value) |
MapSettings |
setProperty(java.lang.String key,
java.lang.String value)
Change a property value in a restricted scope only, depending on execution context.
|
addProperties, addProperties, appendProperty, getBoolean, getDate, getDateTime, getDefaultValue, getDefinition, getDefinitions, getDouble, getEncryption, getFloat, getInt, getKeysStartingWith, getLong, getRawString, getString, getStringArray, getStringArrayBySeparator, getStringLines, hasDefaultValue, hasKey, removeProperty, setProperty, setProperty, setProperty, setProperty, setProperty
public MapSettings()
public MapSettings(PropertyDefinitions definitions)
protected java.util.Optional<java.lang.String> get(java.lang.String key)
protected void set(java.lang.String key, java.lang.String value)
Settings
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Settings
PropertyDefinitions
are ignored,
so the returned values are not the effective values. Basically only
the non-empty results of Settings.getRawString(String)
are returned.
Values are not decrypted if they are encrypted with a secret key.
getProperties
in class Settings
public MapSettings clear()
public MapSettings setProperty(java.lang.String key, java.lang.String value)
Settings
value
is null
setProperty
in class Settings
public MapSettings setProperty(java.lang.String key, java.lang.Integer value)
setProperty
in class Settings
Settings.setProperty(String, String)
public MapSettings setProperty(java.lang.String key, java.lang.Boolean value)
setProperty
in class Settings
Settings.setProperty(String, String)
public MapSettings setProperty(java.lang.String key, java.lang.Long value)
setProperty
in class Settings
Settings.setProperty(String, String)
public Configuration asConfig()
Configuration
proxy on top of this existing Settings
implementation. Changes are reflected in the Configuration
object.