Skip to content

Commit 34c036c

Browse files
committed
Add Lombok annotations to account entities
Replaced manual getters and setters in the account, address, and address history entities with Lombok annotations. This simplifies the code by using the @Getter and @Setter annotations to generate these methods automatically, making the entities more readable and maintainable.
1 parent edd9084 commit 34c036c

File tree

3 files changed

+14
-37
lines changed

3 files changed

+14
-37
lines changed

rsql-common/src/test/java/io/github/perplexhub/rsql/model/account/AccountEntity.java

+4-15
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
import jakarta.persistence.Entity;
55
import jakarta.persistence.Id;
66
import jakarta.persistence.OneToMany;
7+
import lombok.Getter;
8+
import lombok.Setter;
79

810
import java.util.ArrayList;
911
import java.util.List;
1012

13+
@Setter
14+
@Getter
1115
@Entity
1216
public class AccountEntity {
1317

@@ -24,19 +28,4 @@ public AccountEntity(String ident) {
2428
public AccountEntity() {
2529
}
2630

27-
public void setIdent(String ident) {
28-
this.ident = ident;
29-
}
30-
31-
public String getIdent() {
32-
return ident;
33-
}
34-
35-
public List<AddressHistoryEntity> getAddressHistory() {
36-
return addressHistory;
37-
}
38-
39-
public void setAddressHistory(List<AddressHistoryEntity> addressHistory) {
40-
this.addressHistory = addressHistory;
41-
}
4231
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package io.github.perplexhub.rsql.model.account;
22

33
import jakarta.persistence.Embeddable;
4+
import lombok.Getter;
5+
import lombok.Setter;
46

57

8+
@Setter
9+
@Getter
610
@Embeddable
711
public class AddressEntity {
812

@@ -17,19 +21,4 @@ public AddressEntity(String name, String address) {
1721
public AddressEntity() {
1822
}
1923

20-
public String getName() {
21-
return name;
22-
}
23-
24-
public void setName(String name) {
25-
this.name = name;
26-
}
27-
28-
public String getAddress() {
29-
return address;
30-
}
31-
32-
public void setAddress(String value) {
33-
this.address = value;
34-
}
3524
}

rsql-common/src/test/java/io/github/perplexhub/rsql/model/account/AddressHistoryEntity.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@
99
import jakarta.persistence.Id;
1010
import jakarta.persistence.JoinColumn;
1111
import jakarta.persistence.ManyToOne;
12+
import lombok.Getter;
13+
import lombok.Setter;
1214

1315
import java.time.OffsetDateTime;
1416

1517
@Entity
1618
public class AddressHistoryEntity {
1719

20+
@Setter
21+
@Getter
1822
@Id
1923
@GeneratedValue(strategy = GenerationType.SEQUENCE)
2024
@Column(name = "id", nullable = false)
2125
private Long id;
2226

27+
@Setter
28+
@Getter
2329
@ManyToOne
2430
@JoinColumn(name = "account_ident")
2531
AccountEntity account;
@@ -36,10 +42,6 @@ public class AddressHistoryEntity {
3642
@AttributeOverride(name = "address", column = @Column(name = "shipping_address"))
3743
AddressEntity shippingAddress;
3844

39-
public AccountEntity getAccount() {return account;}
40-
41-
public void setAccount(AccountEntity account) {this.account = account;}
42-
4345
public AddressHistoryEntity() {
4446
}
4547

@@ -54,7 +56,4 @@ public AddressHistoryEntity(
5456
this.shippingAddress = shippingAddress;
5557
}
5658

57-
public Long getId() {return id;}
58-
59-
public void setId(Long id) {this.id = id;}
6059
}

0 commit comments

Comments
 (0)