Invoke the Invocation on the instance object, returning the InvocationReturn object. @param invocation Invocation @param Return type @return InvocationReturn
(Invocation invocation)
| 265 | * @return InvocationReturn |
| 266 | */ |
| 267 | @SuppressWarnings("unchecked") |
| 268 | public <R> InvocationReturn<R> invoke(Invocation invocation) { |
| 269 | Method m = methods.get(invocation.methodName); |
| 270 | R ret = null; |
| 271 | Throwable throwable = null; |
| 272 | try { |
| 273 | ret = (R) m.invoke(instance, invocation.args); |
| 274 | } catch (Throwable e) { |
| 275 | throwable = e; |
| 276 | } |
| 277 | return new InvocationReturn<>(invocation.iid, ret, throwable); |
| 278 | } |
| 279 | } |
| 280 | } |