Class BaseKeyedSettingSpecifier<T>

java.lang.Object
net.solarnetwork.settings.support.BaseSettingSpecifier
net.solarnetwork.settings.support.BaseKeyedSettingSpecifier<T>
All Implemented Interfaces:
KeyedSettingSpecifier<T>, MappableSpecifier, SettingSpecifier
Direct Known Subclasses:
BasicSliderSettingSpecifier, BasicTextAreaSettingSpecifier, BasicTitleSettingSpecifier, BasicToggleSettingSpecifier

public abstract class BaseKeyedSettingSpecifier<T> extends BaseSettingSpecifier implements KeyedSettingSpecifier<T>
Base implementation of KeyedSettingSpecifier.
Version:
1.0
Author:
matt
  • Constructor Details

    • BaseKeyedSettingSpecifier

      public BaseKeyedSettingSpecifier(String key, T defaultValue)
      Constructor.

      The transient property will be set to false

      Parameters:
      key - the key
      defaultValue - the default value
    • BaseKeyedSettingSpecifier

      public BaseKeyedSettingSpecifier(String key, T defaultValue, boolean trans)
      Constructor.
      Parameters:
      key - the key
      defaultValue - the default value
      trans - the transient flag value
  • Method Details

    • getKey

      public String getKey()
      Description copied from interface: KeyedSettingSpecifier
      Get the key for this setting.
      Specified by:
      getKey in interface KeyedSettingSpecifier<T>
      Returns:
      the key to associate with this setting
    • getDefaultValue

      public T getDefaultValue()
      Description copied from interface: KeyedSettingSpecifier
      Get the default value for this setting.
      Specified by:
      getDefaultValue in interface KeyedSettingSpecifier<T>
      Returns:
      the default value
    • isTransient

      public boolean isTransient()
      Description copied from interface: KeyedSettingSpecifier
      Get transient flag.

      If a setting is transient, its associated value is never actually persisted and the KeyedSettingSpecifier.getDefaultValue() is treated as its "current" value. This can be used for

      Specified by:
      isTransient in interface KeyedSettingSpecifier<T>
      Returns:
      true if the setting is transient
    • mappedTo

      public SettingSpecifier mappedTo(String prefix)
      Description copied from interface: MappableSpecifier
      Return a setting specifier mapped to a new path.

      This is to allow delegating setting specifiers to re-map the key.

      Specified by:
      mappedTo in interface MappableSpecifier
      Parameters:
      prefix - the new prefix to add to the key
      Returns:
      the new instance
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setTransient

      public void setTransient(boolean value)
      Set the transient flag.
      Parameters:
      value - the flag to set
    • setKey

      public void setKey(String key)
      Set the key.
      Parameters:
      key - the key to set
    • setDefaultValue

      public void setDefaultValue(T defaultValue)
      Set the default value.
      Parameters:
      defaultValue - the default value to set
    • setDescriptionArguments

      public void setDescriptionArguments(Object[] descriptionArguments)
      Set the optional description arguments.
      Parameters:
      descriptionArguments - The arguments to set.
      Since:
      1.2
    • getDescriptionArguments

      public Object[] getDescriptionArguments()
      Description copied from interface: KeyedSettingSpecifier
      Get an optional list of message arguments to use when rendering a description of this specifier.
      Specified by:
      getDescriptionArguments in interface KeyedSettingSpecifier<T>
      Returns:
      An optional list of message arguments.