Skip to content

Latest commit

 

History

History
21 lines (12 loc) · 692 Bytes

File metadata and controls

21 lines (12 loc) · 692 Bytes

DESIGN PATTERN - OBSERVER

TYPE - BEHAVIORAL

The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

This example uses the Java built-in Observer Pattern - java.util.Observer & java.util.Observable

The pull method is used for the observer, ChannelingDisplay, to grab Stock price changes from the subject(observable) StockData

Examples of the Observer Pattern in the JDK include

java.util.Observer/Observable javax.servlet.http.HttpSessionBindingListener javax.servlet.http.HttpSessionAttributeListener javax.faces.event.PhaseListener