/** * Invokes the method on a given instance passing in given parameters. If the invocation yields * {@link InvocationTargetException}, the exception is unwrapped. * * It is a responsibility of the caller to make sure that the method is accessible to the caller. */ public static <T> T invokeAndUnwrap(final Object instance, final Method method, final Object... parameters) throws Throwable { try { return cast(method.invoke(instance, parameters)); } catch (IllegalArgumentException e) { throw ReflectionLogger.LOG.illegalArgumentExceptionOnReflectionInvocation(instance.getClass(), instance, method, Arrays.toString(parameters), e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw e.getCause(); } }
/** * Invokes the method on a given instance passing in given parameters. If the invocation yields * {@link InvocationTargetException}, the exception is unwrapped. * * It is a responsibility of the caller to make sure that the method is accessible to the caller. */ public static <T> T invokeAndUnwrap(final Object instance, final Method method, final Object... parameters) throws Throwable { try { return cast(method.invoke(instance, parameters)); } catch (IllegalArgumentException e) { throw ReflectionLogger.LOG.illegalArgumentExceptionOnReflectionInvocation(instance.getClass(), instance, method, Arrays.toString(parameters), e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw e.getCause(); } }
/** * Invokes the method on a given instance passing in given parameters. If the invocation yields * {@link InvocationTargetException}, the exception is unwrapped. * * It is a responsibility of the caller to make sure that the method is accessible to the caller. */ public static <T> T invokeAndUnwrap(final Object instance, final Method method, final Object... parameters) throws Throwable { try { return cast(method.invoke(instance, parameters)); } catch (IllegalArgumentException e) { throw ReflectionLogger.LOG.illegalArgumentExceptionOnReflectionInvocation(instance.getClass(), instance, method, Arrays.toString(parameters), e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw e.getCause(); } }
/** * Invokes the method on a given instance passing in given parameters. If the invocation yields * {@link InvocationTargetException}, the exception is unwrapped. * * It is a responsibility of the caller to make sure that the method is accessible to the caller. */ public static <T> T invokeAndUnwrap(final Object instance, final Method method, final Object... parameters) throws Throwable { try { return cast(method.invoke(instance, parameters)); } catch (IllegalArgumentException e) { throw ReflectionLogger.LOG.illegalArgumentExceptionOnReflectionInvocation(instance.getClass(), instance, method, Arrays.toString(parameters), e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw e.getCause(); } }
/** * Invokes the method on a given instance passing in given parameters. If the invocation yields * {@link InvocationTargetException}, the exception is unwrapped. * * It is a responsibility of the caller to make sure that the method is accessible to the caller. */ public static <T> T invokeAndUnwrap(final Object instance, final Method method, final Object... parameters) throws Throwable { try { return cast(method.invoke(instance, parameters)); } catch (IllegalArgumentException e) { throw ReflectionLogger.LOG.illegalArgumentExceptionOnReflectionInvocation(instance.getClass(), instance, method, Arrays.toString(parameters), e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw e.getCause(); } }
/** * Invokes the method on a given instance passing in given parameters. If the invocation yields * {@link InvocationTargetException}, the exception is unwrapped. * * It is a responsibility of the caller to make sure that the method is accessible to the caller. */ public static <T> T invokeAndUnwrap(final Object instance, final Method method, final Object... parameters) throws Throwable { try { return cast(method.invoke(instance, parameters)); } catch (IllegalArgumentException e) { throw ReflectionLogger.LOG.illegalArgumentExceptionOnReflectionInvocation(instance.getClass(), instance, method, Arrays.toString(parameters), e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw e.getCause(); } }