javax.rad.util
Class EventHandler.ListenerHandler

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

protected class EventHandler.ListenerHandler
extends java.lang.Object
implements java.lang.reflect.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(java.lang.Object pListener, java.lang.String pMethodName)
          Constructs a new ListenerHandler with a proxy listener interface.
 
Method Summary
 java.lang.Object dispatchEvent(java.lang.Object... pArguments)
          Invokes the listener or the proxy interface.
 boolean equals(java.lang.Object pObject)
          
 int hashCode()
          
 java.lang.Object invoke(java.lang.Object pProxy, java.lang.reflect.Method pMethod, java.lang.Object[] pArguments)
          
 java.lang.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(java.lang.Object pListener,
                                    java.lang.String pMethodName)
Constructs a new ListenerHandler with a proxy listener interface.

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

invoke

public java.lang.Object invoke(java.lang.Object pProxy,
                               java.lang.reflect.Method pMethod,
                               java.lang.Object[] pArguments)
                        throws java.lang.Throwable

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object pObject)

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

dispatchEvent

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

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


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.