package misson1014; public class EmployeeData { //社員ID private String idEmployee; //社員名 private String nmEmployee; //社員名カナ private String knEmployee; //メールアドレス private String mailAddress; //パスワード private String password; //部署ID private String 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++; } //ゲッター public String getIdEmployee() { return idEmployee; } public String getNmEmployee() { return nmEmployee; } public String getKnEmployee() { return knEmployee; } public String getMailAddress() { return mailAddress; } public String getPassword() { return password; } public String getIdDepartment() { return idDepartment; } //セッター public void setIdEmployee(String idEmployee) { //nullチェック if (idEmployee == null) { System.out.println("社員IDが空のため設定できませんでした"); return; } //空文字チェック if (idEmployee.trim().isEmpty()) { System.out.println( "社員IDが空のため設定できませんでした"); return; } this.idEmployee = idEmployee; } public void setNmEmployee(String nmEmployee) { //nullチェック if (nmEmployee == null) { System.out.println("社員名が空のため設定できませんでした"); return; } //空文字チェック if (nmEmployee.trim().isEmpty()) { System.out.println("社員名が空のため設定できませんでした"); return; } this.nmEmployee = nmEmployee; } public void setKnEmployee(String knEmployee) { this.knEmployee = knEmployee; } public void setMailAddress(String mailAddress) { this.mailAddress = mailAddress; } public void setPassword(String password) { this.password = password; } public void setIdDepartment(String idDepartment) { this.idDepartment = idDepartment; } //toString @Override public String toString() { return getIdEmployee() + "\t" + getNmEmployee() + "\t" + getKnEmployee() + "\t" + getMailAddress() + "\t" + getPassword() + "\t" + getIdDepartment(); } //ID一致判定 public boolean isMatchId(String id) { return getIdEmployee().equals(id); } //件数取得 public static int getEmpCount() { return empCount; } }