public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException {
Class<?> aClass = Class.forName("com.sundear.biz.api.biz.mod.dto.ModRecordDto");
Field field = aClass.getDeclaredField("propList");
String typeName = field.getGenericType().getTypeName();
String name = field.getType().getName();
System.out.println("field.getGenericType().getTypeName()=="+typeName);
System.out.println("field.getType().getName()=="+name);
}
输出结果:
field.getGenericType().getTypeName()==java.util.List<com.sundear.biz.api.biz.mod.dto.ModRecordPropDto>
field.getType().getName()==java.util.List