Another way to consolidate what you have learned is to reflect on how the methods defined for models, observers, components, and listeners implement the connecting, activating, fetching, and relaying depicted in the diagram shown in Segment 761:
The Observable
class provides model classes with three essential
methods:
addObserver
method connects observer instances to
model instances.
setChanged
and notifyObservers
methods jointly
activate connected observers by calling their update
methods.
The Observer
interface insists that you define one essential method:
update
method is called by inherited machinery whenever
setChanged
is called, followed by a call to notifyObservers
.
The update
method does whatever you tell it to do; typically it
fetches values from models and relays those values to views.