문서의 이전 판입니다!
compileOnly 'org.projectlombok:lombok:1.18.12' annotationProcessor 'org.projectlombok:lombok:1.18.12' testCompileOnly 'org.projectlombok:lombok:1.18.12' testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
-J-Xmx1024m
AccessLevel.NONE
설정으로 특정 필드 등에 대한 자동 메소드 생성을 막을 수 있다.// 모든 필드에 대해 Getter/Setter를 생성하지만 age 필드의 Setter는 생성하지 않는다. @Data public class Person { @Setter(AccessLevel.NONE) private int age; }
@ToString(excluded={“propertyName”})
형태로 출력시 제외토록 만들어야 한다.@EqualsAndHashCode(of = {})
로 꼭 필요한 필드만 비교하도록 처리한다.@SuppressWarnings("checkstyle:HideUtilityClassConstructor")
equals&hashCode
를 그대로 사용하고자 하는 상황에서 Java FindBugs의 경고를 회피하려면 자식 클래스 쪽에 다음과 같이 설정한다.@EqualsAndHashCode(callSuper = true, of = {})
of = { }
를 넣지 않으면, 자식 클래스의 모든 필드가 비교 대상으로 들어가 버리게 된다.lombok.delombok.ant.DelombokTask
lombok.delombok.ant.Tasks$Delombok
@AllArgsConstructor
, @RequiredArgsConstructor
등에서 자동으로 생성해주던 @ConstructorProperties(필드정보)
가 자동으로 생성이 안되게 바뀐다.lombok.config
에서 lombok.anyConstructor.addConstructorProperties=true
를 명시적으로 주면 자동 생성된다.@JsonProperty
를 비롯한 여러 annotation이 getter/setter 로 복제가 된다.@JsonProperty
값과 getter 의 이름이 다를 경우 두개가 다 외부 응답으로 나갔었는데, getter 의 이름으로 나가던 필드를 사용하는 타 팀이 존재할 경우 값자기 getter 이름쪽 응답이 사라져버린다.BREAKING CHANGE: Lombok will now always copy specific annotations around (from field to getter, from field to builder 'setter', etcetera): A specific curated list of known annotations where that is the right thing to do (generally, @NonNull style annotations from various libraries), as well as any annotations you explicitly list in the lombok.copyableAnnotations config key in your lombok.config file. Also, lombok is more consistent about copying these annotations. (Previous behaviour: Lombok used to copy any annotation whose simple name was NonNull, Nullable, or CheckForNull). Issue #1570 and Issue #1634
@JsonProperty("xxx") private int yyy; -> 진짜 생성은 @JsonProperty("xxx") private int yyy; public void setYyy(int yyy) { this.yyy = yyy; } -> 이로 인해서 JSON 에 XXX, yyy 두개의 필드가 존재하게 됨.
@JsonProperty("xxx") private int yyy; -> 진짜 생성은 @JsonProperty("xxx") private int yyy; // 아래 setter 에도 @JsonProperty 가 붙어버림 @JsonProperty("xxx") public void setYyy(int yyy) { this.yyy = yyy; }
@JsonProperty('yyy')
명시해서 추가해줌.