javax.rad.util
Class EventHandler.ListenerHandler

java.lang.Object
  extended by javax.rad.util.EventHandler.ListenerHandler
All Implemented Interfaces:
InvocationHandler
Enclosing class:
EventHandler<L>

protected class EventHandler.ListenerHandler
extends Object
implements InvocationHandler

Generic Listener that calls reflective the given method. The Method is searched in the order: 1) public void methodName(E pEvent); 2) public void methodName(); If the method does not exist, a NoSuchMethodException is thrown.


Constructor Summary
EventHandler.ListenerHandler(L pListenerInterface)
          Constructs a new ListenerHandler with an listener interface.
EventHandler.ListenerHandler(Object pListener, String pMethodName)
          Constructs a new ListenerHandler with a proxy listener interface.
 
Method Summary
 Object dispatchEvent(Object... pArguments)
          Invokes the listener or the proxy interface.
 boolean equals(Object pObject)
          
 int hashCode()
          
 Object invoke(Object pProxy, Method pMethod, Object[] pArguments)
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventHandler.ListenerHandler

public EventHandler.ListenerHandler(L pListenerInterface)
Constructs a new ListenerHandler with an listener interface.

Parameters:
pListenerInterface - the listener interface.

EventHandler.ListenerHandler

public EventHandler.ListenerHandler(Object pListener,
                                    String pMethodName)
Constructs a new ListenerHandler with a proxy listener interface.

Parameters:
pListener - the listener.
pMethodName - the method name.
Method Detail

invoke

public Object invoke(Object pProxy,
                     Method pMethod,
                     Object[] pArguments)
              throws Throwable

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object pObject)

Overrides:
equals in class Object

toString

public String toString()

Overrides:
toString in class Object

dispatchEvent

public Object dispatchEvent(Object... pArguments)
                     throws Throwable
Invokes the listener or the proxy interface.

Parameters:
pArguments - the Arguments.
Returns:
the result.
Throws:
Throwable - if an error occurs.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.