반응형
package com.example.practice5.lombok.model;
import lombok.Data;
@Data
public class Member {
private Long id;
private Integer age;
}
Delombok 하면...
package com.example.practice5.lombok.model;
public class Member {
private Long id;
private Integer age;
public Member() {
}
public Long getId() {
return this.id;
}
public Integer getAge() {
return this.age;
}
public void setId(Long id) {
this.id = id;
}
public void setAge(Integer age) {
this.age = age;
}
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof Member)) return false;
final Member other = (Member) o;
if (!other.canEqual((Object) this)) return false;
final Object this$id = this.getId();
final Object other$id = other.getId();
if (this$id == null ? other$id != null : !this$id.equals(other$id)) return false;
final Object this$age = this.getAge();
final Object other$age = other.getAge();
if (this$age == null ? other$age != null : !this$age.equals(other$age)) return false;
return true;
}
protected boolean canEqual(final Object other) {
return other instanceof Member;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $id = this.getId();
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
final Object $age = this.getAge();
result = result * PRIME + ($age == null ? 43 : $age.hashCode());
return result;
}
public String toString() {
return "Member(id=" + this.getId() + ", age=" + this.getAge() + ")";
}
}
추천 anotation 세트
@Data
@AllArgsConstructor
@RequiredArgsConstructor
@Builder
public class Member {
private Long id;
private Integer age;
}
반응형
'Spring' 카테고리의 다른 글
[스프링] JPA - @Entity (0) | 2023.07.07 |
---|---|
[스프링] intellij - h2 database (0) | 2023.07.07 |
[스프링] Lombok - @Builder (0) | 2023.07.07 |
[스프링] [java] Lombok annotation (0) | 2023.07.07 |
[스프링] banner 변경 (0) | 2023.07.07 |