Class ForwardingHandler<T>

    • Method Detail

      • of

        public static <T> ForwardingHandler<T> of​(T target)
        Creates handler with specified object as a delegate.
        Type Parameters:
        T - type of proxy/target
        Parameters:
        target - delegate target
        Returns:
        handler that forwards to target
      • swap

        public void swap​(T newTarget)
        Changes target to provided one.
        Parameters:
        newTarget - new delegation target
      • handle

        @Nullable
        public Object handle​(MethodInvocation<T> invocation)
                      throws Throwable
        Description copied from interface: InvocationHandler
        Catches invocation executed on proxy and returns result that should be passed to the client.
        Specified by:
        handle in interface InvocationHandler<T>
        Parameters:
        invocation - invocation captured
        Returns:
        successful result of invocation processing
        Throws:
        Throwable - exception that will be thrown on the call site