通过反射查找泛型的属性值
import java.lang.reflect.Field public <T> void set(){ List<T> list=new ArrayList<T>(); String name="",value=""; for(T t:list){ Class c = t.getClass(); Field[] fs = c.getDeclaredFields(); for(Field temp:fs){ try { temp.set(name, value); } catch (IllegalArgumentException | IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }