首页 > 代码库 > beanutils获取带参数get方法
beanutils获取带参数get方法
public Employee getEmployee(int index) {
return new Employee();
}
1、PropertyUtils.getIndexedProperty带2个参数
// public static void main(String[] args) throws Exception {
// Employee employee=new Employee();
// int index=3;
// String emp="employee["+index+"]";
// //PropertyUtils.setIndexedProperty(employee, num, new Object[]{1,2,3});
// Employee e=(Employee) PropertyUtils.getIndexedProperty(employee, emp);
// System.out.println(e);
// }
2、PropertyUtils.getIndexedProperty带3个参数
public static void main(String[] args) throws Exception {
Employee employee=new Employee();
int index=3;
String emp="employee";
Employee e=(Employee) PropertyUtils.getIndexedProperty(employee, emp,index);
System.out.println(e);
}
beanutils获取带参数get方法