Package org.sonar.api.config.internal
Class MapSettings
- java.lang.Object
-
- org.sonar.api.config.Settings
-
- org.sonar.api.config.internal.MapSettings
-
public class MapSettings extends Settings
In-memory map-based implementation ofSettings. It must be used only for unit tests. This is not the implementation deployed at runtime, so non-test code must never castSettingstoMapSettings.- Since:
- 6.1
-
-
Constructor Summary
Constructors Constructor Description MapSettings()MapSettings(PropertyDefinitions definitions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationasConfig()MapSettingsclear()Delete all propertiesprotected 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 voidremove(java.lang.String key)protected voidset(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.MapSettingssetProperty(java.lang.String key, java.lang.Boolean value)MapSettingssetProperty(java.lang.String key, java.lang.Integer value)MapSettingssetProperty(java.lang.String key, java.lang.Long value)MapSettingssetProperty(java.lang.String key, java.lang.String value)Change a property value in a restricted scope only, depending on execution context.-
Methods inherited from class org.sonar.api.config.Settings
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
-
-
-
-
Constructor Detail
-
MapSettings
public MapSettings()
-
MapSettings
public MapSettings(PropertyDefinitions definitions)
-
-
Method Detail
-
get
protected java.util.Optional<java.lang.String> get(java.lang.String key)
-
set
protected void set(java.lang.String key, java.lang.String value)Description copied from class:SettingsAdd the settings with the specified key and value, both are trimmed and neither can be null.
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Description copied from class:SettingsImmutable map of the properties that have non-default values. The default values defined byPropertyDefinitionsare ignored, so the returned values are not the effective values. Basically only the non-empty results ofSettings.getRawString(String)are returned.Values are not decrypted if they are encrypted with a secret key.
- Specified by:
getPropertiesin classSettings
-
clear
public MapSettings clear()
Delete all properties
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.String value)
Description copied from class:SettingsChange a property value in a restricted scope only, depending on execution context. New value is never persisted. New value is ephemeral and kept in memory only:- during current analysis in the case of scanner stack
- during processing of current HTTP request in the case of web server stack
- during execution of current task in the case of Compute Engine stack
valueisnull- Overrides:
setPropertyin classSettings
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.Integer value)
- Overrides:
setPropertyin classSettings- See Also:
Settings.setProperty(String, String)
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.Boolean value)
- Overrides:
setPropertyin classSettings- See Also:
Settings.setProperty(String, String)
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.Long value)
- Overrides:
setPropertyin classSettings- See Also:
Settings.setProperty(String, String)
-
asConfig
public Configuration asConfig()
- Returns:
- a
Configurationproxy on top of this existingSettingsimplementation. Changes are reflected in theConfigurationobject. - Since:
- 6.5
-
-