Interface Setting<T>

    • Method Detail

      • getValue

        T getValue()
        Returns the value of this setting.
        Returns:
        the value of this setting
      • equalVal

        default boolean equalVal​(T otherVal)
        Check if the value of this Setting object is equal to the given value.
        Parameters:
        otherVal - the other value
        Returns:
        true if the values are equal
      • copy

        Setting<Tcopy()
        Clone the current object.
        Returns:
        an identical copy of the current object
      • visit

        void visit​(SettingVisitor visitor)
        Enable usage of the visitor pattern.
        Parameters:
        visitor - the visitor
      • getNullInstance

        Setting<TgetNullInstance()
        Returns a setting whose value is null. Cannot be static, because there is no static inheritance.
        Returns:
        a Setting object that isn't null itself, but returns null for getValue()
      • setTime

        void setTime​(java.lang.Long time)
        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.
        Parameters:
        time - the time in seconds since epoch
      • setNew

        void setNew​(boolean isNew)
        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).
        Parameters:
        isNew - true, if it is new
      • isNew

        boolean isNew()
        Return if the setting has been marked as new.
        Returns:
        true, if the setting has been marked as new
        See Also:
        setNew(boolean)