Skip to content

Commit 97b4658

Browse files
committed
Implements Lombok plugin and cuts getters and setters.
1 parent 0995a26 commit 97b4658

File tree

3 files changed

+13
-100
lines changed

3 files changed

+13
-100
lines changed

src/main/java/com/sistemacliente/model/Cliente.java

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,15 @@
1414
import jakarta.persistence.Id;
1515
import jakarta.persistence.SequenceGenerator;
1616
import jakarta.persistence.Table;
17-
import jakarta.validation.constraints.Email;
18-
import jakarta.validation.constraints.NotBlank;
19-
import jakarta.validation.constraints.Pattern;
17+
import lombok.Getter;
18+
import lombok.Setter;
2019

21-
@Entity
22-
@Table(name = "cliente")
20+
@Entity @Table(name = "cliente") @Getter @Setter
2321
@SequenceGenerator(name = "seq_cliente", sequenceName = "seq_cliente", initialValue = 1,
2422
allocationSize = 1)
2523
public class Cliente implements Serializable{
2624

27-
public Cliente() {
28-
29-
}
25+
public Cliente() {}
3026

3127
public Cliente(ClienteRequestDTO dto) {
3228
BeanUtils.copyProperties(dto, this);
@@ -47,38 +43,6 @@ public Cliente(ClienteRequestDTO dto) {
4743
@Column(name = "cpf", nullable = false, unique = true, updatable = false)
4844
private String cpf;
4945

50-
public Long getId() {
51-
return id;
52-
}
53-
54-
public void setId(Long id) {
55-
this.id = id;
56-
}
57-
58-
public String getNome() {
59-
return nome;
60-
}
61-
62-
public void setNome(String nome) {
63-
this.nome = nome;
64-
}
65-
66-
public String getEmail() {
67-
return email;
68-
}
69-
70-
public void setEmail(String email) {
71-
this.email = email;
72-
}
73-
74-
public String getCpf() {
75-
return cpf;
76-
}
77-
78-
public void setCpf(String cpf) {
79-
this.cpf = cpf;
80-
}
81-
8246
@Override
8347
public int hashCode() {
8448
return Objects.hash(id);
@@ -96,4 +60,4 @@ public boolean equals(Object obj) {
9660
return Objects.equals(id, other.id);
9761
}
9862

99-
}
63+
}

src/main/java/com/sistemacliente/model/dto/ClienteRequestDTO.java

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import jakarta.validation.constraints.NotBlank;
66
import jakarta.validation.constraints.Pattern;
77
import jakarta.validation.constraints.Size;
8+
import lombok.Getter;
9+
import lombok.Setter;
810

11+
@Getter @Setter
912
public class ClienteRequestDTO {
1013

1114
@NotBlank(message = "Nome deve ter entre 3 e 60 caracteres, não pode ser nulo ou vazio.")
@@ -22,29 +25,5 @@ public class ClienteRequestDTO {
2225
@Pattern(regexp = "\\d{11}", message = "Digite os 11 dígitos do CPF sem ponto e hífen.")
2326
@Column(name = "cpf", nullable = false, unique = true)
2427
private String cpf;
25-
26-
public String getNome() {
27-
return nome;
28-
}
29-
30-
public void setNome(String nome) {
31-
this.nome = nome;
32-
}
33-
34-
public String getEmail() {
35-
return email;
36-
}
37-
38-
public void setEmail(String email) {
39-
this.email = email;
40-
}
41-
42-
public String getCpf() {
43-
return cpf;
44-
}
45-
46-
public void setCpf(String cpf) {
47-
this.cpf = cpf;
48-
}
4928

5029
}

src/main/java/com/sistemacliente/model/dto/ClienteResponseDTO.java

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
import com.sistemacliente.model.Cliente;
66

7-
public class ClienteResponseDTO {
7+
import lombok.Getter;
8+
import lombok.Setter;
89

9-
public ClienteResponseDTO() {
10+
@Getter @Setter
11+
public class ClienteResponseDTO {
1012

11-
}
13+
public ClienteResponseDTO() {}
1214

1315
public ClienteResponseDTO(Cliente cliente) {
1416
BeanUtils.copyProperties(cliente, this);
@@ -18,36 +20,4 @@ public ClienteResponseDTO(Cliente cliente) {
1820
private String nome;
1921
private String email;
2022
private String cpf;
21-
22-
public Long getId() {
23-
return id;
24-
}
25-
26-
public void setId(Long id) {
27-
this.id = id;
28-
}
29-
30-
public String getNome() {
31-
return nome;
32-
}
33-
34-
public void setNome(String nome) {
35-
this.nome = nome;
36-
}
37-
38-
public String getEmail() {
39-
return email;
40-
}
41-
42-
public void setEmail(String email) {
43-
this.email = email;
44-
}
45-
46-
public String getCpf() {
47-
return cpf;
48-
}
49-
50-
public void setCpf(String cpf) {
51-
this.cpf = cpf;
52-
}
5323
}

0 commit comments

Comments
 (0)