我需要创建多个具有相同参数的构造函数,以便我可以从我的 DAO 类中调用这些构造函数来填充不同的下拉值
public static Employee empType(String empCode, String empType) {
Employee emp = new Employee();
emp .empCode= empCode;
emp .empType= empType;
return emp ;
}
public static Employee empDept(String deptCode, String deptName) {
Employee emp = new Employee();
emp .deptCode= deptCode;
emp .deptName= deptName;
return emp ;
}
当我从 DAO 类中引用时,如何引用这些构造函数?
例如
private static Employee myList(ResultSet resultSet) throws SQLException {
return new <what should be here>((resultSet.getString("DB_NAME1")),
(resultSet.getString("DB_NAME2")));
}