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 castSettings
toMapSettings
.- 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 Configuration
asConfig()
MapSettings
clear()
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 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.-
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:Settings
Add 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:Settings
Immutable map of the properties that have non-default values. The default values defined byPropertyDefinitions
are 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:
getProperties
in classSettings
-
clear
public MapSettings clear()
Delete all properties
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.String value)
Description copied from class:Settings
Change 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
value
isnull
- Overrides:
setProperty
in classSettings
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.Integer value)
- Overrides:
setProperty
in classSettings
- See Also:
Settings.setProperty(String, String)
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.Boolean value)
- Overrides:
setProperty
in classSettings
- See Also:
Settings.setProperty(String, String)
-
setProperty
public MapSettings setProperty(java.lang.String key, java.lang.Long value)
- Overrides:
setProperty
in classSettings
- See Also:
Settings.setProperty(String, String)
-
asConfig
public Configuration asConfig()
- Returns:
- a
Configuration
proxy on top of this existingSettings
implementation. Changes are reflected in theConfiguration
object. - Since:
- 6.5
-
-