Configuration
@ServerSide @ComputeEngineSide @ScannerSide @SonarLintSide @Deprecated public abstract class Settings extends Object
Modifier | Constructor and Description |
---|---|
protected |
Settings(PropertyDefinitions definitions,
Encryption encryption)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Settings |
addProperties(Map<String,String> props)
Deprecated.
|
Settings |
addProperties(Properties props)
Deprecated.
|
Settings |
appendProperty(String key,
String value)
Deprecated.
|
protected abstract Optional<String> |
get(String key)
Deprecated.
|
boolean |
getBoolean(String key)
Deprecated.
Effective value as boolean.
|
Date |
getDate(String key)
Deprecated.
Effective value as
Date , without time fields. |
Date |
getDateTime(String key)
Deprecated.
Effective value as
Date , with time fields. |
String |
getDefaultValue(String key)
Deprecated.
|
Optional<PropertyDefinition> |
getDefinition(String key)
Deprecated.
The definition related to the specified property.
|
PropertyDefinitions |
getDefinitions()
Deprecated.
All the property definitions declared by core and plugins.
|
Double |
getDouble(String key)
Deprecated.
Effective value as
Double . |
Encryption |
getEncryption()
Deprecated.
|
Float |
getFloat(String key)
Deprecated.
Effective value as
Float . |
int |
getInt(String key)
Deprecated.
Effective value as
int . |
List<String> |
getKeysStartingWith(String prefix)
Deprecated.
|
long |
getLong(String key)
Deprecated.
Effective value as
long . |
abstract Map<String,String> |
getProperties()
Deprecated.
Immutable map of the properties that have non-default values.
|
Optional<String> |
getRawString(String key)
Deprecated.
The value that overrides the default value.
|
String |
getString(String key)
Deprecated.
The effective value of the specified property.
|
String[] |
getStringArray(String key)
Deprecated.
Value is split by comma and trimmed.
|
String[] |
getStringArrayBySeparator(String key,
String separator)
Deprecated.
Value is split and trimmed.
|
String[] |
getStringLines(String key)
Deprecated.
Value is split by carriage returns.
|
boolean |
hasDefaultValue(String key)
Deprecated.
|
boolean |
hasKey(String key)
Deprecated.
|
protected abstract void |
remove(String key)
Deprecated.
|
Settings |
removeProperty(String key)
Deprecated.
|
protected abstract void |
set(String key,
String value)
Deprecated.
|
Settings |
setProperty(String key,
Boolean value)
Deprecated.
|
Settings |
setProperty(String key,
Date date)
Deprecated.
|
Settings |
setProperty(String key,
Date date,
boolean includeTime)
Deprecated.
|
Settings |
setProperty(String key,
Double value)
Deprecated.
|
Settings |
setProperty(String key,
Float value)
Deprecated.
|
Settings |
setProperty(String key,
Integer value)
Deprecated.
|
Settings |
setProperty(String key,
Long value)
Deprecated.
|
Settings |
setProperty(String key,
String value)
Deprecated.
Change a property value in a restricted scope only, depending on execution context.
|
Settings |
setProperty(String key,
String[] values)
Deprecated.
|
protected Settings(PropertyDefinitions definitions, Encryption encryption)
public abstract Map<String,String> getProperties()
PropertyDefinitions
are ignored,
so the returned values are not the effective values. Basically only
the non-empty results of getRawString(String)
are returned.
Values are not decrypted if they are encrypted with a secret key.
public Encryption getEncryption()
public Optional<String> getRawString(String key)
getString(String)
to get
the effective and decrypted value.public PropertyDefinitions getDefinitions()
public Optional<PropertyDefinition> getDefinition(String key)
public boolean hasKey(String key)
true
if the property has a non-default value, else false
.@CheckForNull public String getDefaultValue(String key)
public boolean hasDefaultValue(String key)
@CheckForNull public String getString(String key)
null
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.
IllegalStateException
- if value is encrypted but fails to be decrypted.public boolean getBoolean(String key)
false
if getString(String)
does not return "true"
, even if it's not a boolean representation.true
if the effective value is "true"
, else false
.public int getInt(String key)
int
.int
. If the property does not have value nor default value, then 0
is returned.NumberFormatException
- if value is not empty and is not a parsable integerpublic long getLong(String key)
long
.long
. If the property does not have value nor default value, then 0L
is returned.NumberFormatException
- if value is not empty and is not a parsable long
@CheckForNull public Date getDate(String key)
Date
, without time fields. Format is DateUtils.DATE_FORMAT
.Date
. If the property does not have value nor default value, then null
is returned.RuntimeException
- if value is not empty and is not in accordance with DateUtils.DATE_FORMAT
.@CheckForNull public Date getDateTime(String key)
Date
, with time fields. Format is DateUtils.DATETIME_FORMAT
.Date
. If the property does not have value nor default value, then null
is returned.RuntimeException
- if value is not empty and is not in accordance with DateUtils.DATETIME_FORMAT
.@CheckForNull public Float getFloat(String key)
Float
.Float
. If the property does not have value nor default value, then null
is returned.NumberFormatException
- if value is not empty and is not a parsable number@CheckForNull public Double getDouble(String key)
Double
.Double
. If the property does not have value nor default value, then null
is returned.NumberFormatException
- if value is not empty and is not a parsable numberpublic String[] getStringArray(String key)
public String[] getStringLines(String key)
public String[] getStringArrayBySeparator(String key, String separator)
public Settings appendProperty(String key, @Nullable String value)
public Settings setProperty(String key, @Nullable String[] values)
public Settings setProperty(String key, @Nullable String value)
value
is null
public Settings setProperty(String key, @Nullable Boolean value)
setProperty(String, String)
public Settings setProperty(String key, @Nullable Integer value)
setProperty(String, String)
public Settings setProperty(String key, @Nullable Long value)
setProperty(String, String)
public Settings setProperty(String key, @Nullable Double value)
setProperty(String, String)
public Settings setProperty(String key, @Nullable Float value)
setProperty(String, String)
public Settings setProperty(String key, @Nullable Date date)
setProperty(String, String)
public Settings addProperties(Map<String,String> props)
public Settings addProperties(Properties props)
public Settings setProperty(String key, @Nullable Date date, boolean includeTime)
setProperty(String, String)
public Settings removeProperty(String key)
public List<String> getKeysStartingWith(String prefix)
Copyright © 2009–2017 SonarSource. All rights reserved.