Skip to content

아이템 35. ordinal 메서드 대신 인스턴스 필드를 사용하라 #94

Answered by Irisation23
JoisFe asked this question in 3. 과제
Discussion options

You must be logged in to vote

정리해주신 내용 잘 봤습니다 😁

혹시 필드를 하나만 두고있는 enum 클래스의 경우 다르게 관리하고 있는 내용은 없을까에 대해 궁금해서 찾아보니
필드가 두개인 점은 다르지만, 배민에 계셨던 이동욱씨의 정리가 나오더군요.

@JoisFe 님이 사용하셨던 numberOfMusicians() 해당 메서드는 lombok의 @Getter로 대체해도 좋은 코드가 될 것 같다는 생각이 드네요!

  • lombok is GOAT 🐐

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JoisFe
Comment options

JoisFe Jan 30, 2023
Maintainer Author

Answer selected by JoisFe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6장 열거 타입과 애너테이션 이펙티브 자바 6장 열거 타입과 애너테이션
2 participants