Class ConfigKey


  • @Public
    public class ConfigKey
    extends java.lang.Object
    A configuration key in a configuration.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Comparator<ConfigKey> ORDERING  
    • 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 a Boolean value.
      java.lang.Class<?> getClass​(org.apache.commons.configuration.Configuration conf)
      Retrieve the setting from the configuration conf as a Class 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 a Class value.
      double getDouble​(org.apache.commons.configuration.Configuration conf)
      Retrieve the setting from the configuration conf as a Double value.
      int getInt​(org.apache.commons.configuration.Configuration conf)
      Retrieve the setting from the configuration conf as a Integer value.
      java.util.List<java.lang.Object> getList​(org.apache.commons.configuration.Configuration conf)
      Retrieve the setting from the configuration conf as a Class value.
      long getLong​(org.apache.commons.configuration.Configuration conf)
      Retrieve the setting from the configuration conf as a Long value.
      short getShort​(org.apache.commons.configuration.Configuration conf)
      Retrieve the setting from the configuration conf as a Short value.
      java.lang.String getString​(org.apache.commons.configuration.Configuration conf)
      Retrieve the setting from the configuration conf as a String 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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.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 set
        value - value of the setting
      • getLong

        public long getLong​(org.apache.commons.configuration.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.configuration.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.configuration.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.configuration.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.configuration.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 java.lang.String getString​(org.apache.commons.configuration.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> 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 a Class 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 a Class 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 a Class 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
      • 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.
      • type

        public ConfigKey type​(Type type)
        Type 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 class java.lang.Object