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 classConfigKey.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.ConfigKeyBuilderbuilder(java.lang.String name)Build a config key of name.java.lang.ObjectdefaultValue()Default value as a string representation.ConfigKeydefaultValue(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.ConfigKeydependents(java.util.List<java.lang.String> dependents)The list of settings dependents on this setting.booleandeprecated()Whether this setting is deprecated or not.ConfigKeydeprecated(boolean deprecated)Whether this setting is deprecated or not.java.lang.StringdeprecatedByConfigKey()The config key that deprecates this key.ConfigKeydeprecatedByConfigKey(java.lang.String deprecatedByConfigKey)The config key that deprecates this key.java.lang.StringdeprecatedSince()The version when this settings was deprecated.ConfigKeydeprecatedSince(java.lang.String deprecatedSince)The version when this settings was deprecated.java.lang.Stringdescription()Description of the configuration setting.ConfigKeydescription(java.lang.String description)Description of the configuration setting.java.lang.Stringdocumentation()Documentation of the configuration setting.ConfigKeydocumentation(java.lang.String documentation)Documentation of the configuration setting.booleanequals(java.lang.Object o)java.lang.Objectget(org.apache.commons.configuration2.Configuration conf)Retrieve the setting value from the provided conf.booleangetBoolean(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aBooleanvalue.java.lang.Class<?>getClass(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aClassvalue.<T> java.lang.Class<? extends T>getClass(org.apache.commons.configuration2.Configuration conf, java.lang.Class<T> interfaceCls)Retrieve the setting from the configuration conf as aClassvalue.doublegetDouble(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aDoublevalue.intgetInt(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aIntegervalue.java.util.List<java.lang.Object>getList(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aClassvalue.longgetLong(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aLongvalue.shortgetShort(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aShortvalue.java.lang.StringgetString(org.apache.commons.configuration2.Configuration conf)Retrieve the setting from the configuration conf as aStringvalue.ConfigKeyGroupgroup()The key-group to group settings together.ConfigKeygroup(ConfigKeyGroup group)The key-group to group settings together.inthashCode()static ConfigKey.ConfigKeyBuilderinternalBuilder()java.lang.Stringname()Name of the configuration setting.ConfigKeyname(java.lang.String name)Name of the configuration setting.java.util.List<java.lang.String>optionValues()The list of options for this setting.ConfigKeyoptionValues(java.util.List<java.lang.String> optionValues)The list of options for this setting.intorderInGroup()The order of the setting in the key-group.ConfigKeyorderInGroup(int orderInGroup)The order of the setting in the key-group.booleanrequired()Flag indicates whether the setting is required.ConfigKeyrequired(boolean required)Flag indicates whether the setting is required.voidset(org.apache.commons.configuration2.Configuration conf, java.lang.Object value)Update the setting name in the configuration conf with the provided value.java.lang.Stringsince()The version when this setting was introduced.ConfigKeysince(java.lang.String since)The version when this setting was introduced.java.lang.StringtoString()Typetype()Type of the configuration setting.ConfigKeytype(Type type)Type of the configuration setting.voidvalidate(org.apache.commons.configuration2.Configuration conf)Validate the setting is valid in the provided config conf.Validatorvalidator()The validator used for validating configuration value.ConfigKeyvalidator(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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
validate
public void validate(org.apache.commons.configuration2.Configuration conf) throws ConfigExceptionValidate the setting is valid in the provided config conf.- Parameters:
conf- configuration to test- Throws:
ConfigException
-
set
public void set(org.apache.commons.configuration2.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.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aLongvalue.- Parameters:
conf- configuration to retrieve the setting- Returns:
- the value as a long number
-
getInt
public int getInt(org.apache.commons.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aIntegervalue.- Parameters:
conf- configuration to retrieve the setting- Returns:
- the value as an integer number
-
getShort
public short getShort(org.apache.commons.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aShortvalue.- Parameters:
conf- configuration to retrieve the setting- Returns:
- the value as a short number
-
getBoolean
public boolean getBoolean(org.apache.commons.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aBooleanvalue.- Parameters:
conf- configuration to retrieve the setting- Returns:
- the value as a boolean flag
-
getDouble
public double getDouble(org.apache.commons.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aDoublevalue.- Parameters:
conf- configuration to retrieve the setting- Returns:
- the value as a double number
-
getString
public java.lang.String getString(org.apache.commons.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aStringvalue.- 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.configuration2.Configuration conf, java.lang.Class<T> interfaceCls)Retrieve the setting from the configuration conf as aClassvalue.- Parameters:
conf- configuration to retrieve the setting- Returns:
- the value as a class
-
getClass
public java.lang.Class<?> getClass(org.apache.commons.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aClassvalue.- 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.configuration2.Configuration conf)
Retrieve the setting from the configuration conf as aClassvalue.- Parameters:
conf- configuration to retrieve the setting- Returns:
- the value as list of values
-
get
public java.lang.Object get(org.apache.commons.configuration2.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:
toStringin classjava.lang.Object
-
-