Class AbstractSetting<T>

java.lang.Object
org.openstreetmap.josm.spi.preferences.AbstractSetting<T>
Type Parameters:
T - The setting type
All Implemented Interfaces:
Setting<T>
Direct Known Subclasses:
ListListSetting, ListSetting, MapListSetting, StringSetting

public abstract class AbstractSetting<T> extends Object implements Setting<T>
Base abstract class of all settings, holding the setting value.
Since:
12881 (moved from package org.openstreetmap.josm.data.preferences)
  • Field Details

  • Constructor Details

    • AbstractSetting

      protected AbstractSetting(T value)
      Constructs a new AbstractSetting with the given value
      Parameters:
      value - The setting value
  • Method Details

    • getValue

      public T getValue()
      Description copied from interface: Setting
      Returns the value of this setting.
      Specified by:
      getValue in interface Setting<T>
      Returns:
      the value of this setting
    • setTime

      public void setTime(Long time)
      Description copied from interface: Setting
      Set the time for this setting. For default preferences. They are saved in a cache file. Keeping the time allows to discard very old default settings.
      Specified by:
      setTime in interface Setting<T>
      Parameters:
      time - the time in seconds since epoch
    • getTime

      public Long getTime()
      Description copied from interface: Setting
      Get the time for this setting.
      Specified by:
      getTime in interface Setting<T>
      Returns:
      the time for this setting
      See Also:
    • setNew

      public void setNew(boolean isNew)
      Description copied from interface: Setting
      Mark setting as new. For default preferences. A setting is marked as new, if it has been seen in the current session. Methods like IPreferences.get(java.lang.String, java.lang.String), can be called from different parts of the code with the same key. In this case, the supplied default value must match. However, this is only an error if the mismatching default value has been seen in the same session (and not loaded from cache).
      Specified by:
      setNew in interface Setting<T>
      Parameters:
      isNew - true, if it is new
    • isNew

      public boolean isNew()
      Description copied from interface: Setting
      Return if the setting has been marked as new.
      Specified by:
      isNew in interface Setting<T>
      Returns:
      true, if the setting has been marked as new
      See Also:
    • toString

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

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object