getEmployeeNameByBatchId(int batchID)
getEmployeeNameBySSN(对象SSN)
getEmployeeNameByEmailId(String emailID)
getEmployeeNameBySalaryAccount(SalaryAccount 薪金账户)
或
getEmployeeName(int typeOfIdentifier, byte[] identifier) -> 在此方法中,typeOfIdentifier 告诉标识符是否为 batchID/SSN/emailID/salaryAccount
以上哪一个是实现 get 方法的更好方法?
这些方法将在 Servlet 中,并通过提供给客户的 API 进行调用。
最佳答案
为什么不重载 getEmployeeName(??) 方法?
getEmployeeName(int BatchID)
getEmployeeName(object SSN)(坏主意)
getEmployeeName(字符串电子邮件)
等等
对我来说似乎是一个很好的“多”方法。
关于java - 获取方法 : One vs Many,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/80892/