Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Key Value Observing in Java

in Objective C one can make use of key value observing to get notifications of changes to objects & then the program can act accordingly; is there something similar in java?

like image 508
Samantha Catania Avatar asked Aug 27 '26 18:08

Samantha Catania


2 Answers

You can look into PropertyChangeListener, which has been part of Java since JDK 1.0:

http://download.oracle.com/javase/tutorial/uiswing/events/propertychangelistener.html

like image 169
duffymo Avatar answered Aug 29 '26 06:08

duffymo


It is not possible in Java without implementing it yourself, so i wrote a little "library".

https://github.com/Appyx/JKVO

like image 22
Appyx Avatar answered Aug 29 '26 07:08

Appyx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!