Class SettableProperty<T>

    • Field Detail

      • modelValue

        protected T modelValue
        Current value of the encapsulated object
      • defaultValue

        protected T defaultValue
        Default value of the encapsulated object
    • Constructor Detail

      • SettableProperty

        public SettableProperty()
        Constructs a new, empty SettableProperty with null modelValue
      • SettableProperty

        public SettableProperty​(T modelValue)
        Constructs a new SettableProperty with the specified modelValue
        Parameters:
        modelValue - a value to be set
    • Method Detail

      • present

        public boolean present()
        Checks if the modelValue is not null
        Returns:
        false if the modelValue is null, true otherwise
      • get

        public T get()
        Returns the current modelValue of this SettableProperty
        Returns:
        the current modelValue
      • set

        public void set​(T modelValue)
        Sets the modelValue of this SettableProperty
        Parameters:
        modelValue - value to be set
      • modify

        public void modify​(UnaryOperator<T> operator)
        Modifies the modelValue of this SettableProperty inline
        Parameters:
        operator - operation to be performed on modelValue
      • resetToDefaultValue

        public void resetToDefaultValue()
        Sets the modelValue of this SettableProperty to the defaultValue. If the defaultValue is null no action will be performed.
      • getDefaultValue

        public T getDefaultValue()
        Returns the defaultValue of this SettableProperty
        Returns:
        the defaultValue of this object
      • setDefaultValue

        public void setDefaultValue​(T defaultValue)
        Sets the defaultValue of this SettableProperty
        Parameters:
        defaultValue - value to be set
      • saveAsDefaultValue

        public void saveAsDefaultValue()
        Sets the defaultValue of this SettableProperty to be equal to the current modelValue