有个类是这么定义的,
public class ClassInfo{
private List<Person> personList; // some other propertyies
// getter and setter
}
public class Person{ private Integer id;
private String name; // getter and setter
}请问我怎么样通过反射
取得 ClassInfor 类中 personList属性的List中定义的元素类型Person类? 谢谢了
public class ClassInfo{
private List<Person> personList; // some other propertyies
// getter and setter
}
public class Person{ private Integer id;
private String name; // getter and setter
}请问我怎么样通过反射
取得 ClassInfor 类中 personList属性的List中定义的元素类型Person类? 谢谢了
解决方案 »
- 如何查询远程主机的CPU,磁盘内存利用率,等信息?
- Hibernate多对一关系.找不到映射文件
- session小问题! 求救!
- 我的一对一主键关联通过主对象查关联对象的属性为什么会出现N+1
- 这是哪个JAVA工具了
- JSP连接数据库问题?
- JbuilderX下运行jsp出现:<Could not obtain an exclusive lock for directory: .\myserver\ldap\ldapfiles. Waiting for 10 seconds and
- 初学JAVA,编译一个简单的I/O程序出错,请指教。谢!
- 关于dom解析xml的问题
- Oracle8.1.6的JDBC驱动程序如何安装?
- servlet的困惑
- 菜鸟问题不断!还是struts 标签。。。
private Map<String, Test> list = new HashMap<String, Test>(); public Type[] getPrameterType() throws SecurityException,
NoSuchFieldException {
return ((ParameterizedType) (Test.class.getDeclaredField("list")
.getGenericType())).getActualTypeArguments();
} public static void main(String[] args) throws Exception {
System.out.println(Arrays.toString(new Test().getPrameterType()));
}}