net.sf.doolin.bus.bean
Class BeanNotificationSupport

java.lang.Object
  extended by net.sf.doolin.bus.bean.BeanNotificationSupport

public class BeanNotificationSupport
extends Object

This class defines an object that can notify the changes of an object to the bus.

Notification of changes can be done on the spot, or buffered or completely stopped.

Any BeanNotificationSupport can have a parent and we can therefore define a hierarchy of beans. Each level in the hierarchy participates in the notification of changes.

For example, in the following hierarchy:

 A {
        B b;
 }

 B {
        C c;
 }

 C {
        String name;
 }
 

If C notifies a change on name as in:

 C {
        ...
        notify("name", "Old value", "A new name");
        ...
 }
 

Following events are generated on the bus:

 C.name := "A new name";
 B.c.name := "A new name";
 A.b.c.name := "A new name";
 

Author:
Damien Coraboeuf

Constructor Summary
BeanNotificationSupport(Object holder)
           
 
Method Summary
protected  PropertyChangeMessage createMessage(String propertyName, Object oldValue, Object newValue)
           
 void notify(String propertyName, Object oldValue, Object newValue)
          Notifies to the bus that a property has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanNotificationSupport

public BeanNotificationSupport(Object holder)
Method Detail

createMessage

protected PropertyChangeMessage createMessage(String propertyName,
                                              Object oldValue,
                                              Object newValue)

notify

public void notify(String propertyName,
                   Object oldValue,
                   Object newValue)
Notifies to the bus that a property has changed. If the notification mode is BUFFERED, the change will be actually sent when notification mode is restored to NORMAL.

Parameters:
propertyName - Name of the property
oldValue - Old value of the property
newValue - New value of the property
See Also:
PropertyChangeMessage


Copyright © 2011. All Rights Reserved.