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 Optional<String> |
get(String key) |
Map<String,String> |
getProperties()
Immutable map of the properties that have non-default values.
|
protected void |
remove(String key) |
protected void |
set(String key,
String value)
Add the settings with the specified key and value, both are trimmed and neither can be null.
|
MapSettings |
setProperty(String key,
Boolean value) |
MapSettings |
setProperty(String key,
Integer value) |
MapSettings |
setProperty(String key,
Long value) |
MapSettings |
setProperty(String key,
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, setPropertypublic MapSettings()
public MapSettings(PropertyDefinitions definitions)
protected void set(String key, String value)
Settingspublic Map<String,String> getProperties()
SettingsPropertyDefinitions 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 Settingspublic MapSettings clear()
public MapSettings setProperty(String key, String value)
Settingsvalue is nullsetProperty in class Settingspublic MapSettings setProperty(String key, Integer value)
setProperty in class SettingsSettings.setProperty(String, String)public MapSettings setProperty(String key, Boolean value)
setProperty in class SettingsSettings.setProperty(String, String)public MapSettings setProperty(String key, Long value)
setProperty in class SettingsSettings.setProperty(String, String)public Configuration asConfig()
Configuration proxy on top of this existing Settings implementation. Changes are reflected in the Configuration object.Copyright © 2009–2017 SonarSource. All rights reserved.