forked from sngular/scs-multiapi-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddressDTO.java
More file actions
94 lines (75 loc) · 2.21 KB
/
Copy pathAddressDTO.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 = AddressDTO.AddressDTOBuilder.class)
public class AddressDTO {
@JsonProperty(value ="city")
private String city;
@JsonProperty(value ="street")
private String street;
private AddressDTO(AddressDTOBuilder builder) {
this.city = builder.city;
this.street = builder.street;
}
public static AddressDTO.AddressDTOBuilder builder() {
return new AddressDTO.AddressDTOBuilder();
}
@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "")
public static class AddressDTOBuilder {
private String city;
private String street;
public AddressDTO.AddressDTOBuilder city(String city) {
this.city = city;
return this;
}
public AddressDTO.AddressDTOBuilder street(String street) {
this.street = street;
return this;
}
public AddressDTO build() {
AddressDTO addressDTO = new AddressDTO(this);
return addressDTO;
}
}
@Schema(name = "city", required = false)
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
@Schema(name = "street", required = false)
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AddressDTO addressDTO = (AddressDTO) o;
return Objects.equals(this.city, addressDTO.city) && Objects.equals(this.street, addressDTO.street);
}
@Override
public int hashCode() {
return Objects.hash(city, street);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("AddressDTO{");
sb.append(" city:").append(city).append(",");
sb.append(" street:").append(street);
sb.append("}");
return sb.toString();
}
}