What is the difference between PropertyChangeListener and VetoableChangeListener?

The main difference resides in the fact that PropertyChangeListener are applied to bound properties while VetoableChangeListener are applied to constrained properties.

A bound property is just a property, while a constrained property is a property on which listeners can express themselves about a change that is going to be made: they can refuse this change from happening.

What it actually happens is that when you notify a vetoable property change you will do something like

VetoableChangeSupport vcs;
vcs.fireVetoableChange(...);

and this can throw a PropertyVetoException which will tell your bean that an observer wishes to block this property change (it should be rolled back).

Tags:

Java