@Test public void invokeCanReturnVoid() throws Exception { ReflectionMethodInvoker<InvokeTestClass, Void> invoker = new ReflectionMethodInvoker<InvokeTestClass, Void>(InvokeTestClass.class, Void.class, "happyVoid"); invoker.invoke(invokeTestInstance); }
public R invoke(T obj, Object... args) throws NoSuchMethodException { Method targetMethod = getTargetMethod(); try { Object rawResult = targetMethod.invoke(obj, args); return returnType.cast(rawResult); } catch (IllegalAccessException e) { throw new SdkClientException(e); } catch (InvocationTargetException e) { throw new SdkClientException(e); } }
ReflectionMethodInvoker { public R invoke(T obj, Object... args) throws NoSuchMethodException { Method targetMethod = getTargetMethod(); try { Object rawResult = targetMethod.invoke(obj, args); return returnType.cast(rawResult); } catch (IllegalAccessException e) { throw new SdkClientException(e); } catch (InvocationTargetException e) { throw new SdkClientException(e); } } }
ReflectionMethodInvoker { public R invoke(T obj, Object... args) throws NoSuchMethodException { Method targetMethod = getTargetMethod(); try { Object rawResult = targetMethod.invoke(obj, args); return returnType.cast(rawResult); } catch (IllegalAccessException e) { throw new SdkClientException(e); } catch (InvocationTargetException e) { throw new SdkClientException(e); } } ReflectionMethodInvoker(Class<T> clazz,
                                   Class<R> returnType,
                                   String methodName,
                                   Class<?>... parameterTypes); }
ReflectionMethodInvoker { public R invoke(T obj, Object... args) throws NoSuchMethodException { Method targetMethod = getTargetMethod(); try { Object rawResult = targetMethod.invoke(obj, args); return returnType.cast(rawResult); } catch (IllegalAccessException e) { throw new SdkClientException(e); } catch (InvocationTargetException e) { throw new SdkClientException(e); } } ReflectionMethodInvoker(Class<T> clazz,
                                   Class<R> returnType,
                                   String methodName,
                                   Class<?>... parameterTypes); R invoke(T obj, Object... args); void initialize(); boolean isInitialized(); }
ReflectionMethodInvoker { public R invoke(T obj, Object... args) throws NoSuchMethodException { Method targetMethod = getTargetMethod(); try { Object rawResult = targetMethod.invoke(obj, args); return returnType.cast(rawResult); } catch (IllegalAccessException e) { throw new SdkClientException(e); } catch (InvocationTargetException e) { throw new SdkClientException(e); } } ReflectionMethodInvoker(Class<T> clazz,
                                   Class<R> returnType,
                                   String methodName,
                                   Class<?>... parameterTypes); R invoke(T obj, Object... args); void initialize(); boolean isInitialized();  }