Generics { public static Type getGenericClassType( final Object instance, final Class<?> clazz, final int position) { Class<?> type = instance.getClass(); while (type != Object.class) { if (type.getGenericSuperclass() instanceof ParameterizedType) { final ParameterizedType genericSuperclass = (ParameterizedType) type.getGenericSuperclass(); if (genericSuperclass.getRawType() == clazz) { return genericSuperclass.getActualTypeArguments()[position]; } else { type = type.getSuperclass(); } } else { type = type.getSuperclass(); } } return null; } private  Generics(); static Type getGenericClassType(
      final Object instance, final Class<?> clazz, final int position); static Type getGenericInterfaceType(
      final Object instance, final Class<?> iface, final int position);  }
@Test public void testGetClassType() throws Exception { assertEquals( SomeClass.class, Generics.getGenericClassType(new ConcreteClass(), GenericClass.class, 0)); }