Class ConfigKey
- java.lang.Object
-
- org.apache.bookkeeper.common.conf.ConfigKey
-
@Public public class ConfigKey extends java.lang.Object
A configuration key in a configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfigKey.ConfigKeyBuilder
-
Constructor Summary
Constructors Constructor Description ConfigKey(boolean required, java.lang.String name, Type type, java.lang.String description, java.lang.String documentation, java.lang.Object defaultValue, java.util.List<java.lang.String> optionValues, Validator validator, ConfigKeyGroup group, int orderInGroup, java.util.List<java.lang.String> dependents, boolean deprecated, java.lang.String deprecatedByConfigKey, java.lang.String deprecatedSince, java.lang.String since)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConfigKey.ConfigKeyBuilder
builder(java.lang.String name)
Build a config key of name.java.lang.Object
defaultValue()
Default value as a string representation.ConfigKey
defaultValue(java.lang.Object defaultValue)
Default value as a string representation.java.util.List<java.lang.String>
dependents()
The list of settings dependents on this setting.ConfigKey
dependents(java.util.List<java.lang.String> dependents)
The list of settings dependents on this setting.boolean
deprecated()
Whether this setting is deprecated or not.ConfigKey
deprecated(boolean deprecated)
Whether this setting is deprecated or not.java.lang.String
deprecatedByConfigKey()
The config key that deprecates this key.ConfigKey
deprecatedByConfigKey(java.lang.String deprecatedByConfigKey)
The config key that deprecates this key.java.lang.String
deprecatedSince()
The version when this settings was deprecated.ConfigKey
deprecatedSince(java.lang.String deprecatedSince)
The version when this settings was deprecated.java.lang.String
description()
Description of the configuration setting.ConfigKey
description(java.lang.String description)
Description of the configuration setting.java.lang.String
documentation()
Documentation of the configuration setting.ConfigKey
documentation(java.lang.String documentation)
Documentation of the configuration setting.boolean
equals(java.lang.Object o)
java.lang.Object
get(org.apache.commons.configuration.Configuration conf)
Retrieve the setting value from the provided conf.boolean
getBoolean(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aBoolean
value.java.lang.Class<?>
getClass(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aClass
value.<T> java.lang.Class<? extends T>
getClass(org.apache.commons.configuration.Configuration conf, java.lang.Class<T> interfaceCls)
Retrieve the setting from the configuration conf as aClass
value.double
getDouble(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aDouble
value.int
getInt(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aInteger
value.java.util.List<java.lang.Object>
getList(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aClass
value.long
getLong(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aLong
value.short
getShort(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aShort
value.java.lang.String
getString(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aString
value.ConfigKeyGroup
group()
The key-group to group settings together.ConfigKey
group(ConfigKeyGroup group)
The key-group to group settings together.int
hashCode()
static ConfigKey.ConfigKeyBuilder
internalBuilder()
java.lang.String
name()
Name of the configuration setting.ConfigKey
name(java.lang.String name)
Name of the configuration setting.java.util.List<java.lang.String>
optionValues()
The list of options for this setting.ConfigKey
optionValues(java.util.List<java.lang.String> optionValues)
The list of options for this setting.int
orderInGroup()
The order of the setting in the key-group.ConfigKey
orderInGroup(int orderInGroup)
The order of the setting in the key-group.boolean
required()
Flag indicates whether the setting is required.ConfigKey
required(boolean required)
Flag indicates whether the setting is required.void
set(org.apache.commons.configuration.Configuration conf, java.lang.Object value)
Update the setting name in the configuration conf with the provided value.java.lang.String
since()
The version when this setting was introduced.ConfigKey
since(java.lang.String since)
The version when this setting was introduced.java.lang.String
toString()
Type
type()
Type of the configuration setting.ConfigKey
type(Type type)
Type of the configuration setting.void
validate(org.apache.commons.configuration.Configuration conf)
Validate the setting is valid in the provided config conf.Validator
validator()
The validator used for validating configuration value.ConfigKey
validator(Validator validator)
The validator used for validating configuration value.
-
-
-
Field Detail
-
ORDERING
public static final java.util.Comparator<ConfigKey> ORDERING
-
-
Constructor Detail
-
ConfigKey
ConfigKey(boolean required, java.lang.String name, Type type, java.lang.String description, java.lang.String documentation, java.lang.Object defaultValue, java.util.List<java.lang.String> optionValues, Validator validator, ConfigKeyGroup group, int orderInGroup, java.util.List<java.lang.String> dependents, boolean deprecated, java.lang.String deprecatedByConfigKey, java.lang.String deprecatedSince, java.lang.String since)
-
-
Method Detail
-
builder
public static ConfigKey.ConfigKeyBuilder builder(java.lang.String name)
Build a config key of name.- Parameters:
name
- config key name- Returns:
- config key builder
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
validate
public void validate(org.apache.commons.configuration.Configuration conf) throws ConfigException
Validate the setting is valid in the provided config conf.- Parameters:
conf
- configuration to test- Throws:
ConfigException
-
set
public void set(org.apache.commons.configuration.Configuration conf, java.lang.Object value)
Update the setting name in the configuration conf with the provided value.- Parameters:
conf
- configuration to setvalue
- value of the setting
-
getLong
public long getLong(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aLong
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as a long number
-
getInt
public int getInt(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aInteger
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as an integer number
-
getShort
public short getShort(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aShort
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as a short number
-
getBoolean
public boolean getBoolean(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aBoolean
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as a boolean flag
-
getDouble
public double getDouble(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aDouble
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as a double number
-
getString
public java.lang.String getString(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aString
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as a string.
-
getClass
public <T> java.lang.Class<? extends T> getClass(org.apache.commons.configuration.Configuration conf, java.lang.Class<T> interfaceCls)
Retrieve the setting from the configuration conf as aClass
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as a class
-
getClass
public java.lang.Class<?> getClass(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aClass
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as a class
-
getList
public java.util.List<java.lang.Object> getList(org.apache.commons.configuration.Configuration conf)
Retrieve the setting from the configuration conf as aClass
value.- Parameters:
conf
- configuration to retrieve the setting- Returns:
- the value as list of values
-
get
public java.lang.Object get(org.apache.commons.configuration.Configuration conf)
Retrieve the setting value from the provided conf.- Returns:
- the setting value
-
internalBuilder
public static ConfigKey.ConfigKeyBuilder internalBuilder()
-
required
public boolean required()
Flag indicates whether the setting is required.
-
name
public java.lang.String name()
Name of the configuration setting.
-
type
public Type type()
Type of the configuration setting.
-
description
public java.lang.String description()
Description of the configuration setting.
-
documentation
public java.lang.String documentation()
Documentation of the configuration setting.
-
defaultValue
public java.lang.Object defaultValue()
Default value as a string representation.
-
optionValues
public java.util.List<java.lang.String> optionValues()
The list of options for this setting.
-
validator
public Validator validator()
The validator used for validating configuration value.
-
group
public ConfigKeyGroup group()
The key-group to group settings together.
-
orderInGroup
public int orderInGroup()
The order of the setting in the key-group.
-
dependents
public java.util.List<java.lang.String> dependents()
The list of settings dependents on this setting.
-
deprecated
public boolean deprecated()
Whether this setting is deprecated or not.
-
deprecatedByConfigKey
public java.lang.String deprecatedByConfigKey()
The config key that deprecates this key.
-
deprecatedSince
public java.lang.String deprecatedSince()
The version when this settings was deprecated.
-
since
public java.lang.String since()
The version when this setting was introduced.
-
required
public ConfigKey required(boolean required)
Flag indicates whether the setting is required.- Returns:
this
.
-
name
public ConfigKey name(java.lang.String name)
Name of the configuration setting.- Returns:
this
.
-
description
public ConfigKey description(java.lang.String description)
Description of the configuration setting.- Returns:
this
.
-
documentation
public ConfigKey documentation(java.lang.String documentation)
Documentation of the configuration setting.- Returns:
this
.
-
defaultValue
public ConfigKey defaultValue(java.lang.Object defaultValue)
Default value as a string representation.- Returns:
this
.
-
optionValues
public ConfigKey optionValues(java.util.List<java.lang.String> optionValues)
The list of options for this setting.- Returns:
this
.
-
validator
public ConfigKey validator(Validator validator)
The validator used for validating configuration value.- Returns:
this
.
-
group
public ConfigKey group(ConfigKeyGroup group)
The key-group to group settings together.- Returns:
this
.
-
orderInGroup
public ConfigKey orderInGroup(int orderInGroup)
The order of the setting in the key-group.- Returns:
this
.
-
dependents
public ConfigKey dependents(java.util.List<java.lang.String> dependents)
The list of settings dependents on this setting.- Returns:
this
.
-
deprecated
public ConfigKey deprecated(boolean deprecated)
Whether this setting is deprecated or not.- Returns:
this
.
-
deprecatedByConfigKey
public ConfigKey deprecatedByConfigKey(java.lang.String deprecatedByConfigKey)
The config key that deprecates this key.- Returns:
this
.
-
deprecatedSince
public ConfigKey deprecatedSince(java.lang.String deprecatedSince)
The version when this settings was deprecated.- Returns:
this
.
-
since
public ConfigKey since(java.lang.String since)
The version when this setting was introduced.- Returns:
this
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-