Skip to content

Commit 74ff952

Browse files
committed
readme updated
1 parent 8e731c7 commit 74ff952

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,26 @@ JavaBeans provides the following implementations for `Property`, each implementa
2525

2626
### Observables
2727

28-
An `ObservableValue` is a value which can be observed for changes using listeners.
28+
An `ObservableValue` is a value which can be observed for changes using listeners. Based
29+
on the `java.util.Supplier` interface.
30+
2931
An `ObservableProperty` is a property which can be observed for changed using listeners.
32+
Based on the `Property` and `ObservableValue` interfaces.
3033

31-
Both `ObservableValue` and `ObservableProperty` have primitive specializations.
34+
Both have primitive specializations for types: `long`, `int`, `boolean`, `double`.
35+
36+
Creation of such properties should be done using `ObservableFactory`.
37+
38+
#### Listeners
39+
40+
Users may register `ChangeListener`s to an _observable_.
41+
Any changes to that _observable_'s value will
42+
cause an invocation of the listener with `ChangeEvent`.
43+
44+
```Java
45+
ObservableIntProperty prop = ....
46+
prop.addChangeListener((e)-> {
47+
System.out.println("New value: " + e.getNewValue())
48+
});
49+
```
3250

33-
There are several implementations provided:
34-
- Simple: a basic variable value which can be read from and written to.
35-
- Atomic: a thread-safe implementation.

0 commit comments

Comments
 (0)