Package org.apache.commons.lang3.event

# Class EventListenerSupport.ProxyInvocationHandler

java.lang.Object
org.apache.commons.lang3.event.EventListenerSupport.ProxyInvocationHandler

All Implemented Interfaces:
  `InvocationHandler`

Enclosing class:
  `EventListenerSupport<L>`

protected class EventListenerSupport.ProxyInvocationHandler extends Object implements InvocationHandler
An invocation handler used to dispatch the event(s) to all the listeners.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProxyInvocationHandler()`
  Constructs a new instance.
  `ProxyInvocationHandler(FailableConsumer<Throwable,IllegalAccessException> handler)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `handle(Throwable t)`
  Handles an exception thrown by a listener.
  `Object`
  `invoke(Object unusedProxy, Method method, Object[] args)`
  Propagates the method call to all registered listeners in place of the proxy listener object.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ProxyInvocationHandler

    public ProxyInvocationHandler()
    Constructs a new instance.

  - ### ProxyInvocationHandler

    public ProxyInvocationHandler(FailableConsumer<Throwable,IllegalAccessException> handler)
    Constructs a new instance.
    Parameters:
      `handler` - Handles Throwables.
    Since:
      3.15.0

- ## Method Details

  - ### handle

    protected void handle(Throwable t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
    Handles an exception thrown by a listener. By default rethrows the given Throwable.
    Parameters:
      `t` - The Throwable
    Throws:
      `IllegalAccessException` - thrown by the listener.
      `IllegalArgumentException` - thrown by the listener.
      `InvocationTargetException` - thrown by the listener.
    Since:
      3.15.0

  - ### invoke

    public Object invoke(Object unusedProxy, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
    Propagates the method call to all registered listeners in place of the proxy listener object.
    Specified by:
      `invoke` in interface `InvocationHandler`
    Parameters:
      `unusedProxy` - the proxy object representing a listener on which the invocation was called; not used
      `method` - 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:
      `InvocationTargetException` - if an error occurs
      `IllegalArgumentException` - if an error occurs
      `IllegalAccessException` - if an error occurs