Class ConfigOption<T>

java.lang.Object
io.github.mmm.base.config.ConfigOption<T>
Type Parameters:
T - type of the value for this option. See getType().

public class ConfigOption<T> extends Object
Represents a single configuration option for a ConfigMap. It is a simple container for the key using a generic type making the ConfigMap type-safe.
Since:
1.0.0
  • Constructor Details

    • ConfigOption

      public ConfigOption(String key, Class<T> type)
      The constructor.
      Parameters:
      key - the key.
      type - the type.
    • ConfigOption

      public ConfigOption(String key, T defaultValue)
      The constructor.
      Parameters:
      key - the key.
      defaultValue - the default value.
    • ConfigOption

      public ConfigOption(String key, Class<T> type, T defaultValue)
      The constructor.
      Parameters:
      key - the key.
      type - the type.
      defaultValue - the default value.
  • Method Details

    • getKey

      public String getKey()
      Returns:
      the key of this configuration option.
    • getType

      public Class<T> getType()
      Returns:
      the Class reflecting the value associated with this key.
    • getDefaultValue

      public T getDefaultValue()
      Returns:
      the optional default value to use if the option is not explicitly configured.
    • toString

      public String toString()
      Overrides:
      toString in class Object