类 ObjectProperty<T>

java.lang.Object
com.iohao.game.common.kit.beans.property.ObjectProperty<T>
所有已实现的接口:
PropertyValueObservable<T>

public final class ObjectProperty<T> extends Object
object - 属性具备监听特性。当值(引用)发生变更时,会触发监听事件。

         YourUser user = new YourUser();

         var property = new ObjectProperty(user);
         // add listener monitor property object
         property.addListener((observable, oldValue, newValue) -> {
             log.info("oldValue:{}, newValue:{}", oldValue, newValue);
         });

         property.set(user); // does not trigger listeners

         YourUser user2 = new YourUser();
         property.set(user2); // When the value changes,listeners are triggered
         property.get(); // value is user2
 
 
作者:
渔民小镇
日期:
2024-04-17
  • 字段详细资料

    • valid

      protected boolean valid
  • 构造器详细资料

    • ObjectProperty

      public ObjectProperty()
    • ObjectProperty

      public ObjectProperty(T value)
  • 方法详细资料