Package org.apache.commons.lang3.event
Class EventListenerSupport.ProxyInvocationHandler
- java.lang.Object
-
- org.apache.commons.lang3.event.EventListenerSupport.ProxyInvocationHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
- Enclosing class:
- EventListenerSupport<L>
protected class EventListenerSupport.ProxyInvocationHandler extends java.lang.Object implements java.lang.reflect.InvocationHandlerInvokes listeners throughinvoke(Object, Method, Object[])in the order added to the underlyingList.
-
-
Constructor Summary
Constructors Constructor Description ProxyInvocationHandler()Constructs a new instance.ProxyInvocationHandler(FailableConsumer<java.lang.Throwable,java.lang.IllegalAccessException> handler)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidhandle(java.lang.Throwable t)Handles an exception thrown by a listener.java.lang.Objectinvoke(java.lang.Object unusedProxy, java.lang.reflect.Method method, java.lang.Object[] args)Propagates the method call to all registered listeners in place of the proxy listener object.
-
-
-
Constructor Detail
-
ProxyInvocationHandler
public ProxyInvocationHandler()
Constructs a new instance.
-
ProxyInvocationHandler
public ProxyInvocationHandler(FailableConsumer<java.lang.Throwable,java.lang.IllegalAccessException> handler)
Constructs a new instance.- Parameters:
handler- Handles Throwables.- Since:
- 3.15.0
-
-
Method Detail
-
handle
protected void handle(java.lang.Throwable t) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetExceptionHandles an exception thrown by a listener. By default rethrows the given Throwable.- Parameters:
t- The Throwable- Throws:
java.lang.IllegalAccessException- thrown by the listener.java.lang.IllegalArgumentException- thrown by the listener.java.lang.reflect.InvocationTargetException- thrown by the listener.- Since:
- 3.15.0
-
invoke
public java.lang.Object invoke(java.lang.Object unusedProxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetExceptionPropagates the method call to all registered listeners in place of the proxy listener object.Calls listeners in the order added to the underlying
List.- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Parameters:
unusedProxy- the proxy object representing a listener on which the invocation was called; not usedmethod- the listener method that will be called on all of the listeners.args- event arguments to propagate to the listeners.- Returns:
- the result of the method call
- Throws:
java.lang.reflect.InvocationTargetException- if an error occursjava.lang.IllegalArgumentException- if an error occursjava.lang.IllegalAccessException- if an error occurs
-
-