1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.supercsv.mock;
17
18 import java.text.SimpleDateFormat;
19
20
21
22
23
24
25 public class CustomerStringBean {
26
27 private String customerNo;
28 private String firstName;
29 private String lastName;
30 private String birthDate;
31 private String mailingAddress;
32 private String married;
33 private String numberOfKids;
34 private String favouriteQuote;
35 private String email;
36 private String loyaltyPoints;
37
38
39
40
41 public CustomerStringBean() {
42 }
43
44
45
46
47
48
49 public CustomerStringBean(final CustomerBean customerBean) {
50 this.customerNo = customerBean.getCustomerNo();
51 this.firstName = customerBean.getFirstName();
52 this.lastName = customerBean.getLastName();
53 this.birthDate = new SimpleDateFormat("dd/MM/yyyy").format(customerBean.getBirthDate());
54 this.mailingAddress = customerBean.getMailingAddress();
55 if( customerBean.getMarried() != null ) {
56 this.married = customerBean.getMarried() ? "Y" : "N";
57 } else {
58 this.married = null;
59 }
60 if( customerBean.getNumberOfKids() != null ) {
61 this.numberOfKids = customerBean.getNumberOfKids().toString();
62 } else {
63 this.numberOfKids = null;
64 }
65 this.favouriteQuote = customerBean.getFavouriteQuote();
66 this.email = customerBean.getEmail();
67 this.loyaltyPoints = String.valueOf(customerBean.getLoyaltyPoints());
68
69 }
70
71
72
73
74 public String getCustomerNo() {
75 return customerNo;
76 }
77
78
79
80
81
82 public void setCustomerNo(String customerNo) {
83 this.customerNo = customerNo;
84 }
85
86
87
88
89 public String getFirstName() {
90 return firstName;
91 }
92
93
94
95
96
97 public void setFirstName(String firstName) {
98 this.firstName = firstName;
99 }
100
101
102
103
104 public String getLastName() {
105 return lastName;
106 }
107
108
109
110
111
112 public void setLastName(String lastName) {
113 this.lastName = lastName;
114 }
115
116
117
118
119 public String getBirthDate() {
120 return birthDate;
121 }
122
123
124
125
126
127 public void setBirthDate(String birthDate) {
128 this.birthDate = birthDate;
129 }
130
131
132
133
134 public String getMailingAddress() {
135 return mailingAddress;
136 }
137
138
139
140
141
142 public void setMailingAddress(String mailingAddress) {
143 this.mailingAddress = mailingAddress;
144 }
145
146
147
148
149 public String getMarried() {
150 return married;
151 }
152
153
154
155
156
157 public void setMarried(String married) {
158 this.married = married;
159 }
160
161
162
163
164 public String getNumberOfKids() {
165 return numberOfKids;
166 }
167
168
169
170
171
172 public void setNumberOfKids(String numberOfKids) {
173 this.numberOfKids = numberOfKids;
174 }
175
176
177
178
179 public String getFavouriteQuote() {
180 return favouriteQuote;
181 }
182
183
184
185
186
187 public void setFavouriteQuote(String favouriteQuote) {
188 this.favouriteQuote = favouriteQuote;
189 }
190
191
192
193
194 public String getEmail() {
195 return email;
196 }
197
198
199
200
201
202 public void setEmail(String email) {
203 this.email = email;
204 }
205
206
207
208
209 public String getLoyaltyPoints() {
210 return loyaltyPoints;
211 }
212
213
214
215
216
217 public void setLoyaltyPoints(String loyaltyPoints) {
218 this.loyaltyPoints = loyaltyPoints;
219 }
220
221 @Override
222 public int hashCode() {
223 final int prime = 31;
224 int result = 1;
225 result = prime * result + ((birthDate == null) ? 0 : birthDate.hashCode());
226 result = prime * result + ((customerNo == null) ? 0 : customerNo.hashCode());
227 result = prime * result + ((email == null) ? 0 : email.hashCode());
228 result = prime * result + ((favouriteQuote == null) ? 0 : favouriteQuote.hashCode());
229 result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
230 result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
231 result = prime * result + ((loyaltyPoints == null) ? 0 : loyaltyPoints.hashCode());
232 result = prime * result + ((mailingAddress == null) ? 0 : mailingAddress.hashCode());
233 result = prime * result + ((married == null) ? 0 : married.hashCode());
234 result = prime * result + ((numberOfKids == null) ? 0 : numberOfKids.hashCode());
235 return result;
236 }
237
238 @Override
239 public boolean equals(Object obj) {
240 if( this == obj ) {
241 return true;
242 }
243 if( obj == null ) {
244 return false;
245 }
246 if( !(obj instanceof CustomerStringBean) ) {
247 return false;
248 }
249 CustomerStringBean other = (CustomerStringBean) obj;
250 if( birthDate == null ) {
251 if( other.birthDate != null ) {
252 return false;
253 }
254 } else if( !birthDate.equals(other.birthDate) ) {
255 return false;
256 }
257 if( customerNo == null ) {
258 if( other.customerNo != null ) {
259 return false;
260 }
261 } else if( !customerNo.equals(other.customerNo) ) {
262 return false;
263 }
264 if( email == null ) {
265 if( other.email != null ) {
266 return false;
267 }
268 } else if( !email.equals(other.email) ) {
269 return false;
270 }
271 if( favouriteQuote == null ) {
272 if( other.favouriteQuote != null ) {
273 return false;
274 }
275 } else if( !favouriteQuote.equals(other.favouriteQuote) ) {
276 return false;
277 }
278 if( firstName == null ) {
279 if( other.firstName != null ) {
280 return false;
281 }
282 } else if( !firstName.equals(other.firstName) ) {
283 return false;
284 }
285 if( lastName == null ) {
286 if( other.lastName != null ) {
287 return false;
288 }
289 } else if( !lastName.equals(other.lastName) ) {
290 return false;
291 }
292 if( loyaltyPoints == null ) {
293 if( other.loyaltyPoints != null ) {
294 return false;
295 }
296 } else if( !loyaltyPoints.equals(other.loyaltyPoints) ) {
297 return false;
298 }
299 if( mailingAddress == null ) {
300 if( other.mailingAddress != null ) {
301 return false;
302 }
303 } else if( !mailingAddress.equals(other.mailingAddress) ) {
304 return false;
305 }
306 if( married == null ) {
307 if( other.married != null ) {
308 return false;
309 }
310 } else if( !married.equals(other.married) ) {
311 return false;
312 }
313 if( numberOfKids == null ) {
314 if( other.numberOfKids != null ) {
315 return false;
316 }
317 } else if( !numberOfKids.equals(other.numberOfKids) ) {
318 return false;
319 }
320 return true;
321 }
322
323 }