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