forked from sngular/scs-multiapi-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomerDTO.java
More file actions
94 lines (75 loc) · 2.21 KB
/
Copy pathCustomerDTO.java
File metadata and controls
94 lines (75 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package com.sngular.multifileplugin.refwithdescription.model;
import java.util.Objects;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@JsonDeserialize(builder = CustomerDTO.CustomerDTOBuilder.class)
public class CustomerDTO {
@JsonProperty(value ="name")
private String name;
@JsonProperty(value ="email")
private String email;
private CustomerDTO(CustomerDTOBuilder builder) {
this.name = builder.name;
this.email = builder.email;
}
public static CustomerDTO.CustomerDTOBuilder builder() {
return new CustomerDTO.CustomerDTOBuilder();
}
@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "")
public static class CustomerDTOBuilder {
private String name;
private String email;
public CustomerDTO.CustomerDTOBuilder name(String name) {
this.name = name;
return this;
}
public CustomerDTO.CustomerDTOBuilder email(String email) {
this.email = email;
return this;
}
public CustomerDTO build() {
CustomerDTO customerDTO = new CustomerDTO(this);
return customerDTO;
}
}
@Schema(name = "name", required = false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Schema(name = "email", required = false)
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CustomerDTO customerDTO = (CustomerDTO) o;
return Objects.equals(this.name, customerDTO.name) && Objects.equals(this.email, customerDTO.email);
}
@Override
public int hashCode() {
return Objects.hash(name, email);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("CustomerDTO{");
sb.append(" name:").append(name).append(",");
sb.append(" email:").append(email);
sb.append("}");
return sb.toString();
}
}