Class AbstractSetting<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean isNew  
      protected java.lang.Long time  
      protected T value  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractSetting​(T value)
      Constructs a new AbstractSetting with the given value
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.Long getTime()
      Get the time for this setting.
      T getValue()
      Returns the value of this setting.
      int hashCode()  
      boolean isNew()
      Return if the setting has been marked as new.
      void setNew​(boolean isNew)
      Mark setting as new.
      void setTime​(java.lang.Long time)
      Set the time for this setting.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        protected final T value
      • time

        protected java.lang.Long time
      • isNew

        protected boolean isNew
    • Constructor Detail

      • AbstractSetting

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

      • 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​(java.lang.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
      • 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:
        Setting.setNew(boolean)
      • toString

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

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object