Package org.sonar.api.config.internal
Class ConfigurationBridge
- java.lang.Object
-
- org.sonar.api.config.internal.ConfigurationBridge
-
- All Implemented Interfaces:
Configuration
public class ConfigurationBridge extends java.lang.Object implements Configuration
Used to help migration fromSettings
toConfiguration
-
-
Constructor Summary
Constructors Constructor Description ConfigurationBridge(Settings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
get(java.lang.String key)
The effective value of the specified property.java.lang.String[]
getStringArray(java.lang.String key)
Used to read multi-valued properties.boolean
hasKey(java.lang.String key)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sonar.api.config.Configuration
getBoolean, getDouble, getFloat, getInt, getLong
-
-
-
-
Constructor Detail
-
ConfigurationBridge
public ConfigurationBridge(Settings settings)
-
-
Method Detail
-
get
public java.util.Optional<java.lang.String> get(java.lang.String key)
Description copied from interface:Configuration
The effective value of the specified property. Can returnOptional#empty()
if the property is not set and has no defined default value.If the property is encrypted with a secret key, then the returned value is decrypted.
- Specified by:
get
in interfaceConfiguration
-
hasKey
public boolean hasKey(java.lang.String key)
- Specified by:
hasKey
in interfaceConfiguration
- Returns:
true
if the property has a non-default value, elsefalse
.
-
getStringArray
public java.lang.String[] getStringArray(java.lang.String key)
Description copied from interface:Configuration
Used to read multi-valued properties.See
PropertyDefinition.Builder.multiValues(boolean)
Multi-valued properties coming from scanner are parsed as CSV lines (ie comma separator and optional double quotes to escape values). Non quoted values are trimmed and empty fields are ignored.
Examples :- "one,two,three " -> ["one", "two", "three"]
- " one, two, three " -> ["one", "two", "three"]
- "one, three" -> ["one", "three"]
- "one,"", three" -> ["one", "", "three"]
- "one, " " , three" -> ["one", " ", "three"]
- "one,\"two,three\",\" four \"" -> ["one", "two,three", " four "]
- Specified by:
getStringArray
in interfaceConfiguration
-
-