public class Table { private String name; private ArrayList<Column> columns; private ArrayList<String> keys; }
获得
public static void main(String[] args) throws NoSuchFieldException, SecurityException { Field f = Table.class.getDeclaredField("columns"); Type genericType = f.getGenericType(); if (genericType != null) { ParameterizedType pt = (ParameterizedType) genericType; Type type = pt.getActualTypeArguments()[0]; System.out.println(type); } }
原文:http://blog.csdn.net/guobangli/article/details/44601423