Class StringProperty
java.lang.Object
com.iohao.net.common.kit.beans.property.StringProperty
- All Implemented Interfaces:
PropertyValueObservable<String>
String - Property has listening feature. A listening event will be triggered when the value changes.
var property = new StringProperty();
// add listener monitor property object
property.addListener((observable, oldValue, newValue) -> {
log.info("oldValue:{}, newValue:{}", oldValue, newValue);
});
property.get(); // value is null
property.set("22"); // When the value changes,listeners are triggered
property.get(); // value is "22"
- Author:
- 渔民小镇
- date:
- 2024-04-17
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(PropertyChangeListener<? super String> listener) Register a change listener to be notified when the value changes.get()get current valuegetValue()Get the current property value.protected voidMark the property as invalid and fire change events to all registered listeners.voidremoveListener(PropertyChangeListener<? super String> listener) Remove a previously registered change listener.voidset current valuevoidSet the property value, triggering listeners if the value changed.toString()
-
Field Details
-
valid
protected boolean valid
-
-
Constructor Details
-
StringProperty
public StringProperty() -
StringProperty
-
-
Method Details
-
getValue
Description copied from interface:PropertyValueObservableGet the current property value.- Returns:
- the current value
-
setValue
Description copied from interface:PropertyValueObservableSet the property value, triggering listeners if the value changed.- Parameters:
value- the new value to set
-
get
-
set
-
toString
-
addListener
Description copied from interface:PropertyValueObservableRegister a change listener to be notified when the value changes.- Specified by:
addListenerin interfacePropertyValueObservable<T>- Parameters:
listener- the listener to register
-
removeListener
Description copied from interface:PropertyValueObservableRemove a previously registered change listener.- Specified by:
removeListenerin interfacePropertyValueObservable<T>- Parameters:
listener- the listener to remove
-
markInvalid
protected void markInvalid()Mark the property as invalid and fire change events to all registered listeners.
-