티스토리 뷰

lombok 사용하여 getter, setter 메소드를 만들 경우

boolean 타입의 필드만 'No candidates found for method call' 해당 문구가 뜨는 현상을 볼 수 있다.

자동으로 생성되는 boolean 타입의 getter는 is로 만들어준다.

 

https://projectlombok.org/features/GetterSetter

 

@Getter and @Setter

 

projectlombok.org

private boolean notice;

User.getNotice();    --> X

User.isNotice();    --> O

 

통일성을 위해 getNotice를 사용하고 싶다면 해당 필드를 선언할 때, Boolean 형식으로 선언하면 get 네이밍을 사용할 수 있다.

 

 

 

* boolean Boolean의 차이점

boolean : true, false의 값만 가질 수 있음 ( 자료형 )

Boolean : null, true, false의 값을 가질 수 있음 ( 참조형 )

댓글
링크
최근에 올라온 글
Total
Today
Yesterday