Skip to content

Commit

Permalink
Add Lombok annotations to account entities
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ng-galien committed Jul 18, 2024
1 parent edd9084 commit 34c036c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Setter
@Getter
@Entity
public class AccountEntity {

Expand All @@ -24,19 +28,4 @@ public AccountEntity(String ident) {
public AccountEntity() {
}

public void setIdent(String ident) {
this.ident = ident;
}

public String getIdent() {
return ident;
}

public List<AddressHistoryEntity> getAddressHistory() {
return addressHistory;
}

public void setAddressHistory(List<AddressHistoryEntity> addressHistory) {
this.addressHistory = addressHistory;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package io.github.perplexhub.rsql.model.account;

import jakarta.persistence.Embeddable;
import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
@Embeddable
public class AddressEntity {

Expand All @@ -17,19 +21,4 @@ public AddressEntity(String name, String address) {
public AddressEntity() {
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAddress() {
return address;
}

public void setAddress(String value) {
this.address = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.Getter;
import lombok.Setter;

import java.time.OffsetDateTime;

@Entity
public class AddressHistoryEntity {

@Setter
@Getter
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "id", nullable = false)
private Long id;

@Setter
@Getter
@ManyToOne
@JoinColumn(name = "account_ident")
AccountEntity account;
Expand All @@ -36,10 +42,6 @@ public class AddressHistoryEntity {
@AttributeOverride(name = "address", column = @Column(name = "shipping_address"))
AddressEntity shippingAddress;

public AccountEntity getAccount() {return account;}

public void setAccount(AccountEntity account) {this.account = account;}

public AddressHistoryEntity() {
}

Expand All @@ -54,7 +56,4 @@ public AddressHistoryEntity(
this.shippingAddress = shippingAddress;
}

public Long getId() {return id;}

public void setId(Long id) {this.id = id;}
}

0 comments on commit 34c036c

Please sign in to comment.