private static <I> void invokeOnInjectee(Invokable<? super I, Object> method, I injectee) { try { method.invoke(injectee); } catch (InvocationTargetException ie) { throw propagate(ie.getTargetException()); } catch (IllegalAccessException e) { throw propagate(e); } }
@Test public void testTypeToken() throws NoSuchMethodException, SecurityException, InvocationTargetException, IllegalAccessException { TypeToken<TypeTokenTest> token = TypeToken.of(TypeTokenTest.class); Invokable<TypeTokenTest, ?> invokable = token.method(TypeTokenTest.class.getMethod("helloWorld")); invokable.invoke(this); }