Class ConfigKey

java.lang.Object
org.apache.bookkeeper.common.conf.ConfigKey

@Public public class ConfigKey extends Object
A configuration key in a configuration.
  • Field Details

  • Constructor Details

    • ConfigKey

      ConfigKey(boolean required, String name, Type type, String description, String documentation, Object defaultValue, List<String> optionValues, Validator validator, ConfigKeyGroup group, int orderInGroup, List<String> dependents, boolean deprecated, String deprecatedByConfigKey, String deprecatedSince, String since)
      Creates a new ConfigKey instance.
      Parameters:
      required - Flag indicates whether the setting is required.
      name - Name of the configuration setting.
      type - Type of the configuration setting.
      description - Description of the configuration setting.
      documentation - Documentation of the configuration setting.
      defaultValue - Default value as a string representation.
      optionValues - The list of options for this setting.
      validator - The validator used for validating configuration value.
      group - The key-group to group settings together.
      orderInGroup - The order of the setting in the key-group.
      dependents - The list of settings dependents on this setting.
      deprecated - Whether this setting is deprecated or not.
      deprecatedByConfigKey - The config key that deprecates this key.
      deprecatedSince - The version when this settings was deprecated.
      since - The version when this setting was introduced.
  • Method Details

    • builder

      public static ConfigKey.ConfigKeyBuilder builder(String name)
      Build a config key of name.
      Parameters:
      name - config key name
      Returns:
      config key builder
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • validate

      public void validate(org.apache.commons.configuration2.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.configuration2.Configuration conf, Object value)
      Update the setting name in the configuration conf with the provided value.
      Parameters:
      conf - configuration to set
      value - value of the setting
    • getLong

      public long getLong(org.apache.commons.configuration2.Configuration conf)
      Retrieve the setting from the configuration conf as a Long value.
      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 a Integer value.
      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 a Short value.
      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 a Boolean value.
      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 a Double value.
      Parameters:
      conf - configuration to retrieve the setting
      Returns:
      the value as a double number
    • getString

      public String getString(org.apache.commons.configuration2.Configuration conf)
      Retrieve the setting from the configuration conf as a String value.
      Parameters:
      conf - configuration to retrieve the setting
      Returns:
      the value as a string.
    • getClass

      public <T> Class<? extends T> getClass(org.apache.commons.configuration2.Configuration conf, Class<T> interfaceCls)
      Retrieve the setting from the configuration conf as a Class value.
      Parameters:
      conf - configuration to retrieve the setting
      Returns:
      the value as a class
    • getClass

      public Class<?> getClass(org.apache.commons.configuration2.Configuration conf)
      Retrieve the setting from the configuration conf as a Class value.
      Parameters:
      conf - configuration to retrieve the setting
      Returns:
      the value as a class
    • getList

      public List<Object> getList(org.apache.commons.configuration2.Configuration conf)
      Retrieve the setting from the configuration conf as a Class value.
      Parameters:
      conf - configuration to retrieve the setting
      Returns:
      the value as list of values
    • get

      public 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 String name()
      Name of the configuration setting.
    • type

      public Type type()
      Type of the configuration setting.
    • description

      public String description()
      Description of the configuration setting.
    • documentation

      public String documentation()
      Documentation of the configuration setting.
    • defaultValue

      public Object defaultValue()
      Default value as a string representation.
    • optionValues

      public List<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 List<String> dependents()
      The list of settings dependents on this setting.
    • deprecated

      public boolean deprecated()
      Whether this setting is deprecated or not.
    • deprecatedByConfigKey

      public String deprecatedByConfigKey()
      The config key that deprecates this key.
    • deprecatedSince

      public String deprecatedSince()
      The version when this settings was deprecated.
    • since

      public 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(String name)
      Name of the configuration setting.
      Returns:
      this.
    • type

      public ConfigKey type(Type type)
      Type of the configuration setting.
      Returns:
      this.
    • description

      public ConfigKey description(String description)
      Description of the configuration setting.
      Returns:
      this.
    • documentation

      public ConfigKey documentation(String documentation)
      Documentation of the configuration setting.
      Returns:
      this.
    • defaultValue

      public ConfigKey defaultValue(Object defaultValue)
      Default value as a string representation.
      Returns:
      this.
    • optionValues

      public ConfigKey optionValues(List<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(List<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(String deprecatedByConfigKey)
      The config key that deprecates this key.
      Returns:
      this.
    • deprecatedSince

      public ConfigKey deprecatedSince(String deprecatedSince)
      The version when this settings was deprecated.
      Returns:
      this.
    • since

      public ConfigKey since(String since)
      The version when this setting was introduced.
      Returns:
      this.
    • toString

      public String toString()
      Overrides:
      toString in class Object