Class LongProperty

java.lang.Object
com.iohao.net.common.kit.beans.property.LongProperty
All Implemented Interfaces:
PropertyValueObservable<Number>

public final class LongProperty extends Object
long - Property has listening feature. A listening event will be triggered when the value changes.
        var property = new LongProperty();
        // add listener monitor property object
        property.addListener((observable, oldValue, newValue) -> {
            log.info("oldValue:{}, newValue:{}", oldValue, newValue);
        });

        property.get(); // value is 0
        property.set(22); // When the value changes,listeners are triggered
        property.get(); // value is 22

Author:
渔民小镇
date:
2024-04-17
  • Field Details

    • valid

      protected boolean valid
  • Constructor Details

    • LongProperty

      public LongProperty()
    • LongProperty

      public LongProperty(long value)
  • Method Details

    • getValue

      public Long getValue()
      Description copied from interface: PropertyValueObservable
      get PropertyValue
      Returns:
      current value
    • setValue

      public void setValue(Number value)
      Description copied from interface: PropertyValueObservable
      set value
      Parameters:
      value - value
    • get

      public long get()
      get current value
      Returns:
      current value
    • set

      public void set(long newValue)
      set current value
      Parameters:
      newValue - current new value
    • increment

      public void increment()
      current value + 1
    • decrement

      public void decrement()
      current value - 1
    • addListener

      public void addListener(PropertyChangeListener<? super Number> listener)
      Description copied from interface: PropertyValueObservable
      add ChangeListener
      Specified by:
      addListener in interface PropertyValueObservable<T>
      Parameters:
      listener - ChangeListener
    • removeListener

      public void removeListener(PropertyChangeListener<? super Number> listener)
      Description copied from interface: PropertyValueObservable
      remove ChangeListener
      Specified by:
      removeListener in interface PropertyValueObservable<T>
      Parameters:
      listener - ChangeListener
    • markInvalid

      protected void markInvalid()