1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.primefaces.extensions.model.inputplace;
23
24 import java.io.Serializable;
25 import java.util.Map;
26 import java.util.Objects;
27 import java.util.StringJoiner;
28
29
30
31
32
33
34
35 public class Place implements Serializable {
36
37 private static final long serialVersionUID = 1L;
38
39 private String placeId;
40 private String formattedAddress;
41 private String name;
42 private String addressLine;
43 private String postalCode;
44 private String city;
45 private String state;
46 private String country;
47 private String countryCode;
48 private String administrativeAreaLevel1;
49 private String administrativeAreaLevel2;
50 private String administrativeAreaLevel3;
51 private String types;
52 private String url;
53 private String phone;
54 private double latitude;
55 private double longitude;
56
57 public Place() {
58
59 }
60
61 public Place(final String clientId, final Map<String, String> params) {
62 this.placeId = params.get(clientId + "_place_id");
63 this.name = params.get(clientId + "_name");
64 this.formattedAddress = params.get(clientId + "_formatted_address");
65 this.addressLine = params.get(clientId + "_address");
66 this.postalCode = params.get(clientId + "_postcode");
67 this.city = params.get(clientId + "_city");
68 this.state = params.get(clientId + "_state");
69 this.country = params.get(clientId + "_country");
70 this.countryCode = params.get(clientId + "_country_code");
71 this.latitude = Double.parseDouble(params.get(clientId + "_lat"));
72 this.longitude = Double.parseDouble(params.get(clientId + "_lng"));
73 this.administrativeAreaLevel1 = params.get(clientId + "_administrative_area_level_1");
74 this.administrativeAreaLevel2 = params.get(clientId + "_administrative_area_level_2");
75 this.administrativeAreaLevel3 = params.get(clientId + "_administrative_area_level_3");
76 this.types = params.get(clientId + "_types");
77 this.url = params.get(clientId + "_url");
78 this.phone = params.get(clientId + "_phone");
79 }
80
81 public String getPlaceId() {
82 return placeId;
83 }
84
85 public void setPlaceId(String placeId) {
86 this.placeId = placeId;
87 }
88
89 public String getFormattedAddress() {
90 return formattedAddress;
91 }
92
93 public void setFormattedAddress(String formattedAddress) {
94 this.formattedAddress = formattedAddress;
95 }
96
97 public String getName() {
98 return name;
99 }
100
101 public void setName(String name) {
102 this.name = name;
103 }
104
105 public String getAddressLine() {
106 return addressLine;
107 }
108
109 public void setAddressLine(String addressLine) {
110 this.addressLine = addressLine;
111 }
112
113 public String getPostalCode() {
114 return postalCode;
115 }
116
117 public void setPostalCode(String postalCode) {
118 this.postalCode = postalCode;
119 }
120
121 public String getCity() {
122 return city;
123 }
124
125 public void setCity(String city) {
126 this.city = city;
127 }
128
129 public String getState() {
130 return state;
131 }
132
133 public void setState(String state) {
134 this.state = state;
135 }
136
137 public String getCountry() {
138 return country;
139 }
140
141 public void setCountry(String country) {
142 this.country = country;
143 }
144
145 public String getCountryCode() {
146 return countryCode;
147 }
148
149 public void setCountryCode(String countryCode) {
150 this.countryCode = countryCode;
151 }
152
153 public String getAdministrativeAreaLevel1() {
154 return administrativeAreaLevel1;
155 }
156
157 public void setAdministrativeAreaLevel1(String administrativeAreaLevel1) {
158 this.administrativeAreaLevel1 = administrativeAreaLevel1;
159 }
160
161 public String getAdministrativeAreaLevel2() {
162 return administrativeAreaLevel2;
163 }
164
165 public void setAdministrativeAreaLevel2(String administrativeAreaLevel2) {
166 this.administrativeAreaLevel2 = administrativeAreaLevel2;
167 }
168
169 public String getAdministrativeAreaLevel3() {
170 return administrativeAreaLevel3;
171 }
172
173 public void setAdministrativeAreaLevel3(String administrativeAreaLevel3) {
174 this.administrativeAreaLevel3 = administrativeAreaLevel3;
175 }
176
177 public String getTypes() {
178 return types;
179 }
180
181 public void setTypes(String types) {
182 this.types = types;
183 }
184
185 public double getLatitude() {
186 return latitude;
187 }
188
189 public void setLatitude(double latitude) {
190 this.latitude = latitude;
191 }
192
193 public double getLongitude() {
194 return longitude;
195 }
196
197 public void setLongitude(double longitude) {
198 this.longitude = longitude;
199 }
200
201 public String getUrl() {
202 return url;
203 }
204
205 public void setUrl(String url) {
206 this.url = url;
207 }
208
209 public String getPhone() {
210 return phone;
211 }
212
213 public void setPhone(String phone) {
214 this.phone = phone;
215 }
216
217 @Override
218 public boolean equals(Object o) {
219 if (this == o) {
220 return true;
221 }
222 if (o == null || getClass() != o.getClass()) {
223 return false;
224 }
225 Place place = (Place) o;
226 return Objects.equals(getPlaceId(), place.getPlaceId()) && Objects.equals(getFormattedAddress(), place.getFormattedAddress());
227 }
228
229 @Override
230 public int hashCode() {
231 return Objects.hash(getPlaceId(), getFormattedAddress());
232 }
233
234 @Override
235 public String toString() {
236 return new StringJoiner(", ", Place.class.getSimpleName() + "[", "]")
237 .add("placeId='" + placeId + "'")
238 .add("formattedAddress='" + formattedAddress + "'")
239 .add("name='" + name + "'")
240 .add("addressLine='" + addressLine + "'")
241 .add("postalCode='" + postalCode + "'")
242 .add("city='" + city + "'")
243 .add("state='" + state + "'")
244 .add("country='" + country + "'")
245 .add("countryCode='" + countryCode + "'")
246 .add("administrativeAreaLevel1='" + administrativeAreaLevel1 + "'")
247 .add("administrativeAreaLevel2='" + administrativeAreaLevel2 + "'")
248 .add("administrativeAreaLevel3='" + administrativeAreaLevel3 + "'")
249 .add("types='" + types + "'")
250 .add("url='" + url + "'")
251 .add("phone='" + phone + "'")
252 .add("latitude=" + latitude)
253 .add("longitude=" + longitude)
254 .toString();
255 }
256 }