Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
missed a unsaved file
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-chrismc committed Oct 8, 2018
1 parent a7906b8 commit fcbff69
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions Assignments/JavaRmi/RecordsManagment/src/Models/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,41 @@ public String getHashIndex() {
return Character.toString(Character.toLowerCase(m_LastName.charAt(0)));
}

public void manipulateFeild(Record record, Feild feild, Object newValue) throws Exception {
public void manipulateFeild(Feild feild, Object newValue) throws Exception {
switch (feild) {
case FIRST_NAME:
if (newValue.getClass() == String.class) {
setFirstName((String) newValue);
} else {
throw new Exception("Invalid paramater");
}
break;
case LAST_NAME:
if (newValue.getClass() == String.class) {
setLastName((String) newValue);
} else {
throw new Exception("Invalid paramater");
}
break;
case EMPLOYEE_ID:
if (newValue.getClass() == Integer.class) {
setEmployeeNumber((int) newValue);
} else {
throw new Exception("Invalid paramater");
}
break;
case MAIL_ID:
if (newValue.getClass() == String.class) {
setMailId((String) newValue);
} else {
throw new Exception("Invalid paramater");
}
break;
default:
throw new Exception("Unknow Feild");
}
}

private void setFirstName(String firstName) {
m_FirstName = firstName;
}
Expand Down

0 comments on commit fcbff69

Please sign in to comment.