Skip to content

Commit

Permalink
[refactor]: GetApplicantsStatusResponse of 메서드 최적화
Browse files Browse the repository at this point in the history
  • Loading branch information
LJH098 committed Sep 16, 2024
1 parent 1bffd86 commit 54f4b92
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,17 @@ public class GetApplicantsStatusResponse {
private ApplicantState state;

public static GetApplicantsStatusResponse of(Map<String, Object> result) {
ApplicantState state;
if (result.get(PASS_STATE_KEY) instanceof ApplicantState applicantState) {
state = applicantState;
} else {
throw ApplicantWrongStateException.wrongStatusException;
return GetApplicantsStatusResponse.builder()
.field((String) result.get("field"))
.field1((String) result.get("field1"))
.field2((String) result.get("field2"))
.name((String) result.get("name"))
.id((String) result.get("id"))
.year((Integer) result.get("year"))
.state(applicantState)
.build();
}
return GetApplicantsStatusResponse.builder()
.field((String) result.get("field"))
.field1((String) result.get("field1"))
.field2((String) result.get("field2"))
.name((String) result.get("name"))
.id((String) result.get("id"))
.year((Integer) result.get("year"))
.state(state)
.build();
throw ApplicantWrongStateException.wrongStatusException;
}
}
}

0 comments on commit 54f4b92

Please sign in to comment.