类 ObjectProperty<T>
java.lang.Object
com.iohao.game.common.kit.beans.property.ObjectProperty<T>
- 所有已实现的接口:
PropertyValueObservable<T>
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
-
字段概要
-
构造器概要
-
方法概要
修饰符和类型方法说明void
addListener
(PropertyChangeListener<? super T> listener) add ChangeListenerget()
get current valuegetValue()
get PropertyValueprotected void
void
removeListener
(PropertyChangeListener<? super T> listener) remove ChangeListenervoid
set current valuevoid
set value
-
字段详细资料
-
valid
protected boolean valid
-
-
构造器详细资料
-
ObjectProperty
public ObjectProperty() -
ObjectProperty
-
-
方法详细资料
-
getValue
从接口复制的说明:PropertyValueObservable
get PropertyValue- 返回:
- current value
-
setValue
从接口复制的说明:PropertyValueObservable
set value- 参数:
value
- value
-
get
get current value- 返回:
- current value
-
set
set current value- 参数:
newValue
- current new value
-
addListener
从接口复制的说明:PropertyValueObservable
add ChangeListener- 指定者:
addListener
在接口中PropertyValueObservable<T>
- 参数:
listener
- ChangeListener
-
removeListener
从接口复制的说明:PropertyValueObservable
remove ChangeListener- 指定者:
removeListener
在接口中PropertyValueObservable<T>
- 参数:
listener
- ChangeListener
-
markInvalid
protected void markInvalid()
-