Code example for PropertyChangeEvent

Methods: getNewValue, getOldValue, getPropertyName, getSource

0
     * Logs the change 
     * @param evt - a property change event for the sickLeaveHours or vacationHours property 
     */ 
    @Override 
    public void propertyChange(PropertyChangeEvent evt) {
        String propName = evt.getPropertyName();
        int oldValue = (Integer) evt.getOldValue();
        int newValue = (Integer) evt.getNewValue();
        Consultant consultant = (Consultant) evt.getSource();
        LOGGER.info(
                String.format("%s changed from %d to %d for %s",
                        propName, oldValue, newValue, consultant.getName()));
    } 
}