1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.supercsv.mock;
17  
18  import java.util.Date;
19  
20  
21  
22  
23  
24  
25  public class CustomerBean extends PersonBean implements Customer {
26  	
27  	private String customerNo;
28  	
29  	private long loyaltyPoints;
30  	
31  	private String mailingAddress;
32  	
33  	
34  
35  
36  	public CustomerBean() {
37  	}
38  	
39  	
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  	public CustomerBean(final String customerNo, final String firstName, final String lastName, final Date birthDate,
54  		final String mailingAddress, final Boolean married, final Integer numberOfKids, final String favouriteQuote,
55  		final String email, final long loyaltyPoints) {
56  		super(firstName, lastName, birthDate, married, numberOfKids, favouriteQuote, email);
57  		this.customerNo = customerNo;
58  		this.loyaltyPoints = loyaltyPoints;
59  		this.mailingAddress = mailingAddress;
60  	}
61  	
62  	
63  
64  
65  	public String getCustomerNo() {
66  		return customerNo;
67  	}
68  	
69  	
70  
71  
72  
73  	public void setCustomerNo(String customerNo) {
74  		this.customerNo = customerNo;
75  	}
76  	
77  	
78  
79  
80  	public long getLoyaltyPoints() {
81  		return loyaltyPoints;
82  	}
83  	
84  	
85  
86  
87  
88  	public void setLoyaltyPoints(long loyaltyPoints) {
89  		this.loyaltyPoints = loyaltyPoints;
90  	}
91  	
92  	
93  
94  
95  	public String getMailingAddress() {
96  		return mailingAddress;
97  	}
98  	
99  	
100 
101 
102 
103 	public void setMailingAddress(String mailingAddress) {
104 		this.mailingAddress = mailingAddress;
105 	}
106 	
107 	@Override
108 	public int hashCode() {
109 		final int prime = 31;
110 		int result = super.hashCode();
111 		result = prime * result + ((customerNo == null) ? 0 : customerNo.hashCode());
112 		result = prime * result + (int) (loyaltyPoints ^ (loyaltyPoints >>> 32));
113 		result = prime * result + ((mailingAddress == null) ? 0 : mailingAddress.hashCode());
114 		return result;
115 	}
116 	
117 	@Override
118 	public boolean equals(final Object obj) {
119 		if( this == obj ) {
120 			return true;
121 		}
122 		if( !super.equals(obj) ) {
123 			return false;
124 		}
125 		if( !(obj instanceof CustomerBean) ) {
126 			return false;
127 		}
128 		CustomerBean other = (CustomerBean) obj;
129 		if( customerNo == null ) {
130 			if( other.customerNo != null ) {
131 				return false;
132 			}
133 		} else if( !customerNo.equals(other.customerNo) ) {
134 			return false;
135 		}
136 		if( loyaltyPoints != other.loyaltyPoints ) {
137 			return false;
138 		}
139 		if( mailingAddress == null ) {
140 			if( other.mailingAddress != null ) {
141 				return false;
142 			}
143 		} else if( !mailingAddress.equals(other.mailingAddress) ) {
144 			return false;
145 		}
146 		return true;
147 	}
148 	
149 	@Override
150 	public String toString() {
151 		return String
152 			.format(
153 				"CustomerBean [customerNo=%s, firstName=%s, lastName=%s, birthDate=%s, mailingAddress=%s, married=%s, numberOfKids=%s, favouriteQuote=%s, email=%s, loyaltyPoints=%s]",
154 				customerNo, getFirstName(), getLastName(), getBirthDate(), mailingAddress, getMarried(),
155 				getNumberOfKids(), getFavouriteQuote(), getEmail(), loyaltyPoints);
156 	}
157 	
158 }