@Test public void invokeInterface() { List<Type> invoked = TypeUtil.invoke(List.class, StringList.class); assertThat(invoked.size(), is(1)); assertThat(invoked.get(0), is((Type) String.class)); }
private static List<Type> invokeInterface(Class<?> target, GenericContext context) { assert target != null; assert context != null; assert target.isInterface(); GenericContext bottom = findBottomClass(target, context); if (bottom == null) { return null; } if (target == bottom.raw) { return bottom.getTypeArguments(); } return findInterface(target, bottom); }
TypeUtil { private static List<Type> invokeInterface(Class<?> target, GenericContext context) { assert target != null; assert context != null; assert target.isInterface(); GenericContext bottom = findBottomClass(target, context); if (bottom == null) { return null; } if (target == bottom.raw) { return bottom.getTypeArguments(); } return findInterface(target, bottom); } }
TypeUtil { private static List<Type> invokeInterface(Class<?> target, GenericContext context) { assert target != null; assert context != null; assert target.isInterface(); GenericContext bottom = findBottomClass(target, context); if (bottom == null) { return null; } if (target == bottom.raw) { return bottom.getTypeArguments(); } return findInterface(target, bottom); } private  TypeUtil(); }
TypeUtil { private static List<Type> invokeInterface(Class<?> target, GenericContext context) { assert target != null; assert context != null; assert target.isInterface(); GenericContext bottom = findBottomClass(target, context); if (bottom == null) { return null; } if (target == bottom.raw) { return bottom.getTypeArguments(); } return findInterface(target, bottom); } private  TypeUtil(); static Class<?> erase(Type type); static List<Type> invoke(Class<?> target, Type context); }
TypeUtil { private static List<Type> invokeInterface(Class<?> target, GenericContext context) { assert target != null; assert context != null; assert target.isInterface(); GenericContext bottom = findBottomClass(target, context); if (bottom == null) { return null; } if (target == bottom.raw) { return bottom.getTypeArguments(); } return findInterface(target, bottom); } private  TypeUtil(); static Class<?> erase(Type type); static List<Type> invoke(Class<?> target, Type context);  }