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