Class 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.InvocationHandler
    An invocation handler used to dispatch the event(s) to all the listeners.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void handle​(java.lang.Throwable t)
      Handles an exception thrown by a listener.
      java.lang.Object invoke​(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.InvocationTargetException
        Handles 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.InvocationTargetException
        Propagates the method call to all registered listeners in place of the proxy listener object.
        Specified by:
        invoke in interface java.lang.reflect.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:
        java.lang.reflect.InvocationTargetException - if an error occurs
        java.lang.IllegalArgumentException - if an error occurs
        java.lang.IllegalAccessException - if an error occurs