Key-Value-Observing in Java
This project is an implementation of the KVO provided by ObjectiveC in Java.
- Make your model class extend JKVObservable
- Replace your setter methods with:
setValue(Object newValue){
this.value=setKVOValue("identifier", this.value, newValue);
} - Make your target class implement JKVObserver
- Call addObserver and removeObserver at any place
- Make sure to always use the setters and the corresponding identifiers ;)
-
Just copy/paste the java files
-
Import the Jar file