org.perfectjpattern.core.behavioral.observer
Class ObserverProxy<E>

java.lang.Object
  extended by org.perfectjpattern.core.behavioral.observer.ObserverProxy<E>
Type Parameters:
E - Type of event data that this IObserver subscribes to.
All Implemented Interfaces:
IObserver<E>

public final class ObserverProxy<E>
extends Object
implements IObserver<E>

Implementation of IObserver interface that acts as a Proxy to any plain non-Observer class type. Makes possible to have any given class type to Observe more than one type of Subject without update method name and signature clash.

Version:
$Revision: 1.0 $ $Date: Jul 1, 2007 5:20:12 AM $
Author:
Giovanni Azua
See Also:
IObserver
 

Constructor Summary
ObserverProxy(Class aClass, String aMethodName, Class... aParameters)
          Constructs ObserverProxy from a target static class
ObserverProxy(Object anObject, String aMethodName, Class... aParameters)
          Constructs ObserverProxy from a target instance
 
Method Summary
 void update(E anEventData)
          Notification from ISubject instance that a change has ocurred.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObserverProxy

public ObserverProxy(Object anObject,
                     String aMethodName,
                     Class... aParameters)
Constructs ObserverProxy from a target instance

Parameters:
anObject - Target Object that will handle the notification message
aMethodName - Target method implemented in anObject that will handle notification messages
aParameters - Type of parameters passed in notification events e.g. changed state etc

ObserverProxy

public ObserverProxy(Class aClass,
                     String aMethodName,
                     Class... aParameters)
Constructs ObserverProxy from a target static class

Parameters:
aClass - Target helper static class that will handle the notification message
aMethodName - Target static method implemented in aClass that will handle notification messages
aParameters - Type of parameters passed in notification events e.g. changed state etc
Method Detail

update

public void update(E anEventData)
Notification from ISubject instance that a change has ocurred.

Specified by:
update in interface IObserver<E>
Parameters:
anEventData - Event data pushed to IObserver instances.


Copyright © 2007-2009. All Rights Reserved.