net.sf.doolin.bus.support
Class BothWayPropertyChangeSubscriber

java.lang.Object
  extended by net.sf.doolin.bus.support.AbstractSubscriber<PropertyChangeMessage>
      extended by net.sf.doolin.bus.support.BothWayPropertyChangeSubscriber
All Implemented Interfaces:
Subscriber<PropertyChangeMessage>, SubscriberExecution<PropertyChangeMessage>, SubscriberTrigger<PropertyChangeMessage>, SubscriberValidator

public final class BothWayPropertyChangeSubscriber
extends AbstractSubscriber<PropertyChangeMessage>

This subscriber connects two properties in two different beans, in both directions. If the property of the source bean changes, then the property on the target bean is updated and vice-versa.

Author:
Damien Coraboeuf

Constructor Summary
BothWayPropertyChangeSubscriber(SubscriberValidator validator, Object sourceBean, String sourcePropertyPath, Object targetBean, String targetPropertyPath)
          Constructor.
 
Method Summary
 boolean accept(PropertyChangeMessage message)
          Checks the message
 String getExecutionDescription()
          Describes the execution.
 String getTriggerDescription()
          Description for the trigger
 void receive(PropertyChangeMessage message)
          This method called whenever a message is received.
 String toString()
           
 
Methods inherited from class net.sf.doolin.bus.support.AbstractSubscriber
getMessageClass, getValidatorDescription, isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BothWayPropertyChangeSubscriber

public BothWayPropertyChangeSubscriber(SubscriberValidator validator,
                                       Object sourceBean,
                                       String sourcePropertyPath,
                                       Object targetBean,
                                       String targetPropertyPath)
Constructor.

Parameters:
validator - Validator for the subscription
sourceBean - Source bean
sourcePropertyPath - Source property path
targetBean - Target bean
targetPropertyPath - Target property path
Method Detail

getExecutionDescription

public String getExecutionDescription()
Description copied from interface: SubscriberExecution
Describes the execution. This information is used for debugging purpose only.

Returns:
A description of the execution.

getTriggerDescription

public String getTriggerDescription()
Description copied from interface: SubscriberTrigger
Description for the trigger


accept

public boolean accept(PropertyChangeMessage message)
Description copied from interface: SubscriberTrigger
Checks the message


receive

public void receive(PropertyChangeMessage message)
Description copied from interface: SubscriberExecution
This method called whenever a message is received.

Parameters:
message - Message to handle

toString

public String toString()
Overrides:
toString in class AbstractSubscriber<PropertyChangeMessage>


Copyright © 2011. All Rights Reserved.