3日目の追加段階以外完了
This commit is contained in:
@@ -1,15 +1,112 @@
|
||||
|
||||
public class EmployeeData {
|
||||
String idEmployee;
|
||||
String nmEmployee;
|
||||
String knEmployee;
|
||||
String mailAddress;
|
||||
String password;
|
||||
String idDepartment;
|
||||
public class EmployeeData extends BaseData{
|
||||
private String idEmployee;
|
||||
private String nmEmployee;
|
||||
private String knEmployee;
|
||||
private String mailAddress;
|
||||
private String password;
|
||||
private String idDepartment;
|
||||
|
||||
|
||||
public void showInfo() {
|
||||
System.out.println(this.idEmployee + "\t" + this.nmEmployee + "\t" + this.knEmployee + "\t" +
|
||||
this.mailAddress + "\t" + this.password + "\t" + this.idDepartment);
|
||||
//ゲッターとセッター
|
||||
public String getIdEmployee() {
|
||||
return idEmployee;
|
||||
}
|
||||
|
||||
public void setIdEmployee(String idEmployee) {
|
||||
if(idEmployee == null || idEmployee.strip().isEmpty()) {
|
||||
System.out.println("社員IDが空のため設定できませんでした");
|
||||
}else {
|
||||
this.idEmployee = idEmployee;
|
||||
}
|
||||
}
|
||||
|
||||
public String getNmEmployee() {
|
||||
return nmEmployee;
|
||||
}
|
||||
|
||||
public void setNmEmployee(String nmEmployee) {
|
||||
if(nmEmployee == null || nmEmployee.strip().isEmpty()) {
|
||||
System.out.println("社員名が空のため設定できませんでした");
|
||||
}else {
|
||||
this.nmEmployee = nmEmployee;
|
||||
}
|
||||
}
|
||||
|
||||
public String getKnEmployee() {
|
||||
return knEmployee;
|
||||
}
|
||||
|
||||
public void setKnEmployee(String knEmployee) {
|
||||
this.knEmployee = knEmployee;
|
||||
}
|
||||
|
||||
public String getMailAddress() {
|
||||
return mailAddress;
|
||||
}
|
||||
|
||||
public void setMailAddress(String mailAddress) {
|
||||
this.mailAddress = mailAddress;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getIdDepartment() {
|
||||
return idDepartment;
|
||||
}
|
||||
|
||||
public void setIdDepartment(String idDepartment) {
|
||||
this.idDepartment = idDepartment;
|
||||
}
|
||||
|
||||
private static int empCount = 0;
|
||||
//引数なしコンストラクタ
|
||||
public EmployeeData() {
|
||||
empCount++;
|
||||
}
|
||||
|
||||
//引数をもつコンストラクタ
|
||||
public EmployeeData(String idEmployee, String nmEmployee,
|
||||
String knEmployee, String mailAddress,
|
||||
String password, String idDepartment) {
|
||||
this.setIdEmployee(idEmployee);
|
||||
this.setNmEmployee(nmEmployee);
|
||||
this.setKnEmployee(knEmployee);
|
||||
this.setMailAddress(mailAddress);
|
||||
this.setPassword(password);
|
||||
this.setIdDepartment(idDepartment);
|
||||
empCount++;
|
||||
}
|
||||
|
||||
//メソッド
|
||||
@Override
|
||||
public String toString() {
|
||||
return(this.getIdEmployee() + "\t" + this.getNmEmployee() + "\t" + this.getKnEmployee() + "\t" +
|
||||
this.getMailAddress() + "\t" + this.getPassword() + "\t" + this.getIdDepartment());
|
||||
}
|
||||
|
||||
public boolean isMatchId(String id) {
|
||||
return this.idEmployee.equals(id);
|
||||
}
|
||||
|
||||
static int getEmpCount() {
|
||||
return empCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toCSV() {
|
||||
return (this.getIdEmployee() + "," + this.getNmEmployee() + "," + this.getKnEmployee() + "," +
|
||||
this.getMailAddress() + "," + this.getPassword() + "," + this.getIdDepartment());
|
||||
}
|
||||
|
||||
public String getPrimaryKeyValue() {
|
||||
return this.idEmployee;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user