如何解决从java中的数组调用参数化构造函数
我正在上Employee
类
public class Employee {
Employee(String,fName,String lName,String company,String dept){
this.fName=fName;
this.lName=lName;
this.company=company;
this.dept=dept;
}
}
在Service
方法中,我使用类似
Map employeDataMap = getEmpData(empId);
final String FIELD_ARRAY["fName","lName","company","dept"]
Employee e = new Employee (
map.get(FIELD_ARRAY[0]).toString(),map.get(FIELD_ARRAY[1]).toString(),map.get(FIELD_ARRAY[2]).toString(),map.get(FIELD_ARRAY[3]).toString()
)
一切正常,但我想动态填充构造函数,而不是0,1,2,4
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com(将#修改为@)