With the arrival of Java 9, the Observable
class and the Observer
interface are now deprecated.
The Observable
javadoc states:
[Observable] and the Observer interface have been deprecated. The event model supported by Observer and Observable is quite limited, the order of notifications delivered by Observable is unspecified, and state changes are not in one-for-one correspondence with notifications. For a richer event model, consider using the java.beans package.
It recommends to use the java.beans
package, but how does one go about using it to create an event-handler to mimic the Observer Pattern?