The two bound property registration methods you just learned about
public void addPropertyChangeListener (PropertyChangeListener l);
public void removePropertyChangeListener (PropertyChangeListener l);
apply to all properties, meaning that all bound properties will deliver notifications to a listener.
It is up to the listener to determine which specific property changed.
Although this approach works fine, there is also a way for a listener to bind to a specific property.
A Bean supports individual property binding by providing a pair of registration methods for each property.
For example, following is a pair of listener registration methods for a bound property named
score:
These methods work just like the global listener registration methods,
except that they only apply to the score property.
Per-property registration methods are always provided in addition to the global registration methods and primarily serve as a convenience. In the next lesson, you learn about constrained properties.