/** * Wraps the given {@code delegate} in an InvocationHandler that wraps exceptions not declared on the method * in a {@link org.axonframework.commandhandling.CommandExecutionException}. * * @param delegate The delegate to invoke that potentially throws exceptions * @param declaredExceptions The exceptions declared on the method signature * @param <R> The response type of the command handler * @return an InvocationHandler that wraps undeclared exceptions in a {@code CommandExecutionException} */ protected <R> InvocationHandler<R> wrapUndeclaredExceptions(final InvocationHandler<R> delegate, final Class<?>[] declaredExceptions) { return new WrapNonDeclaredCheckedExceptions<>(delegate, declaredExceptions); }
/** * Wraps the given {@code delegate} in an InvocationHandler that wraps exceptions not declared on the method * in a {@link org.axonframework.commandhandling.CommandExecutionException}. * * @param delegate The delegate to invoke that potentially throws exceptions * @param declaredExceptions The exceptions declared on the method signature * @param <R> The response type of the command handler * @return an InvocationHandler that wraps undeclared exceptions in a {@code CommandExecutionException} */ protected <R> InvocationHandler<R> wrapUndeclaredExceptions(final InvocationHandler<R> delegate, final Class<?>[] declaredExceptions) { return new WrapNonDeclaredCheckedExceptions<>(delegate, declaredExceptions); }
/** * Wraps the given {@code delegate} in an InvocationHandler that wraps exceptions not declared on the method * in a {@link org.axonframework.commandhandling.CommandExecutionException}. * * @param delegate The delegate to invoke that potentially throws exceptions * @param declaredExceptions The exceptions declared on the method signature * @param <R> The response type of the command handler * @return an InvocationHandler that wraps undeclared exceptions in a {@code CommandExecutionException} */ protected <R> InvocationHandler<R> wrapUndeclaredExceptions(final InvocationHandler<R> delegate, final Class<?>[] declaredExceptions) { return new WrapNonDeclaredCheckedExceptions<>(delegate, declaredExceptions); }