Interface Setting<T>

  • Type Parameters:
    T -
    All Known Implementing Classes:
    BooleanSetting, EnumSetting, IntSetting, LongSetting, StringSetting

    public interface Setting<T>
    This is an abstraction for an application/framework setting. A Setting can be read from a DynamicConfig instance. It has a name and also an associated default value which is used when a DynamicConfig instance does not hold a value for this Setting.

    The Setting abstraction is parameterized with the type of the given setting.

    Author:
    Elias Lindholm (elilin)
    • Method Detail

      • name

        String name()
        The name of this Setting. Used when reading this Setting from a DynamicConfig instance.

      • getFrom

        DynamicProperty<T> getFrom​(DynamicConfig config)
        Reads this Setting from the given DynamicConfig instance. If the DynamicConfig instance does not hold a value for this Setting, then the default value will be returned.
        Parameters:
        config - DynamicConfig instance to read this setting from
        Returns:
        This value of this setting in the given DynamicConfig instance, or the default value if the DynamicConfig instance does not contain a value for this Setting
      • defaultValue

        T defaultValue()
        The default value for this setting. For settings of primitive types this method returns the boxed version of the given type, and never returns null.