-
Notifications
You must be signed in to change notification settings - Fork 10
문소현 2주차 과제 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
문소현 2주차 과제 #3
Conversation
| // 일치하는 회원이 있다면, AuthLoginResponse로 변환하여 반환한다. | ||
| return AuthLoginResponse.from(member); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석 틀리게 작성됐던 것 지금 확인했네요.. 좋습니다!!@@!
| Optional<Member> OptionalMember = memberRepository.findById(memberId); | ||
|
|
||
| if(OptionalMember.isEmpty()) { | ||
| throw new IllegalArgumentException(); | ||
| } | ||
|
|
||
| Member member = OptionalMember.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
꼼꼼하게 잘 처리해주셨습니다!
Optional을 직접적으로 사용하는 것보다는 아래처럼 사용하는 것이 권장되는 편입니다.
| Optional<Member> OptionalMember = memberRepository.findById(memberId); | |
| if(OptionalMember.isEmpty()) { | |
| throw new IllegalArgumentException(); | |
| } | |
| Member member = OptionalMember.get(); | |
| Member member = memberRepository.findById(memberId) | |
| .orElseThrow(() -> new IllegalArgumentException("에러 발생")); | |
Java Optional 바르게 사용하기 블로그 글 한 번 정독해보시는 것을 추천드릴게요!!
jjunhub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전체적으로 완벽하게 잘 해주셨습니다. 첨부해드린 블로그 꼭 읽어보시고 추후 프로젝트에 적용하시면 코드 가독성 측면에서 많이 좋아질 거라구 생각합니다. 고생하셨습니다!
Uh oh!
There was an error while loading. Please reload this page.