Generics { public static Type getGenericInterfaceType( final Object instance, final Class<?> iface, final int position) { Class<?> type = instance.getClass(); while (type != Object.class) { for (final Type genericType : type.getGenericInterfaces()) { if (genericType instanceof ParameterizedType) { final ParameterizedType parameterizedType = (ParameterizedType) genericType; if (parameterizedType.getRawType() == iface) { return parameterizedType.getActualTypeArguments()[position]; } } } 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 testGetInterfaceType() throws Exception { assertEquals( String.class, Generics.getGenericInterfaceType(new ConcreteInterface(), GenericInterface.class, 0)); assertEquals( SomeClass.class, Generics.getGenericInterfaceType(new ConcreteInterface(), GenericInterface.class, 1)); }