|
18 | 18 |
|
19 | 19 | import java.io.Serializable; |
20 | 20 |
|
21 | | -import javax.persistence.Basic; |
22 | | -import javax.persistence.Column; |
23 | | -import javax.persistence.Entity; |
24 | | -import javax.persistence.GeneratedValue; |
25 | | -import javax.persistence.GenerationType; |
26 | | -import javax.persistence.Id; |
27 | | -import javax.persistence.Table; |
28 | | - |
29 | | -@Entity |
30 | | -@Table(name="address") |
31 | | -public class Address implements Serializable { |
32 | | - |
33 | | -private static final long serialVersionUID = -1304880008685206811L; |
34 | | - |
35 | | -private Long id; |
36 | | -private String formatted; |
37 | | -private String streetAddress; |
38 | | -private String locality; |
39 | | -private String region; |
40 | | -private String postalCode; |
41 | | -private String country; |
| 21 | +public interface Address extends Serializable { |
42 | 22 |
|
43 | 23 | /** |
44 | | - * Empty constructor |
| 24 | + * @return the formatted address |
45 | 25 | */ |
46 | | -public Address() { |
47 | | - |
48 | | -} |
49 | | - |
50 | | -/** |
51 | | - * @return the formatted address string |
52 | | - */ |
53 | | -@Basic |
54 | | -@Column(name = "formatted") |
55 | | -public String getFormatted() { |
56 | | -return formatted; |
57 | | -} |
| 26 | +public String getFormatted(); |
| 27 | + |
58 | 28 | /** |
59 | 29 | * @param formatted the formatted address to set |
60 | 30 | */ |
61 | | -public void setFormatted(String formatted) { |
62 | | -this.formatted = formatted; |
63 | | -} |
| 31 | +public void setFormatted(String formatted); |
| 32 | + |
64 | 33 | /** |
65 | 34 | * @return the streetAddress |
66 | 35 | */ |
67 | | -@Basic |
68 | | -@Column(name="street_address") |
69 | | -public String getStreetAddress() { |
70 | | -return streetAddress; |
71 | | -} |
| 36 | +public String getStreetAddress(); |
| 37 | + |
72 | 38 | /** |
73 | 39 | * @param streetAddress the streetAddress to set |
74 | 40 | */ |
75 | | -public void setStreetAddress(String streetAddress) { |
76 | | -this.streetAddress = streetAddress; |
77 | | -} |
| 41 | +public void setStreetAddress(String streetAddress); |
| 42 | + |
78 | 43 | /** |
79 | 44 | * @return the locality |
80 | 45 | */ |
81 | | -@Basic |
82 | | -@Column(name = "locality") |
83 | | -public String getLocality() { |
84 | | -return locality; |
85 | | -} |
| 46 | +public String getLocality(); |
| 47 | + |
86 | 48 | /** |
87 | 49 | * @param locality the locality to set |
88 | 50 | */ |
89 | | -public void setLocality(String locality) { |
90 | | -this.locality = locality; |
91 | | -} |
| 51 | +public void setLocality(String locality); |
| 52 | + |
92 | 53 | /** |
93 | 54 | * @return the region |
94 | 55 | */ |
95 | | -@Basic |
96 | | -@Column(name = "region") |
97 | | -public String getRegion() { |
98 | | -return region; |
99 | | -} |
| 56 | +public String getRegion(); |
| 57 | + |
100 | 58 | /** |
101 | 59 | * @param region the region to set |
102 | 60 | */ |
103 | | -public void setRegion(String region) { |
104 | | -this.region = region; |
105 | | -} |
| 61 | +public void setRegion(String region); |
| 62 | + |
106 | 63 | /** |
107 | 64 | * @return the postalCode |
108 | 65 | */ |
109 | | -@Basic |
110 | | -@Column(name="postal_code") |
111 | | -public String getPostalCode() { |
112 | | -return postalCode; |
113 | | -} |
| 66 | +public String getPostalCode(); |
| 67 | + |
114 | 68 | /** |
115 | 69 | * @param postalCode the postalCode to set |
116 | 70 | */ |
117 | | -public void setPostalCode(String postalCode) { |
118 | | -this.postalCode = postalCode; |
119 | | -} |
| 71 | +public void setPostalCode(String postalCode); |
| 72 | + |
120 | 73 | /** |
121 | 74 | * @return the country |
122 | 75 | */ |
123 | | -@Basic |
124 | | -@Column(name = "country") |
125 | | -public String getCountry() { |
126 | | -return country; |
127 | | -} |
| 76 | +public String getCountry(); |
| 77 | + |
128 | 78 | /** |
129 | 79 | * @param country the country to set |
130 | 80 | */ |
131 | | -public void setCountry(String country) { |
132 | | -this.country = country; |
133 | | -} |
134 | | - |
135 | | -/** |
136 | | - * @return the id |
137 | | - */ |
138 | | -@Id |
139 | | -@GeneratedValue(strategy=GenerationType.IDENTITY) |
140 | | -@Column(name = "id") |
141 | | -public Long getId() { |
142 | | -return id; |
143 | | -} |
144 | | - |
145 | | -/** |
146 | | - * @param id the id to set |
147 | | - */ |
148 | | -public void setId(Long id) { |
149 | | -this.id = id; |
150 | | -} |
151 | | - |
152 | | -/* (non-Javadoc) |
153 | | - * @see java.lang.Object#hashCode() |
154 | | - */ |
155 | | -@Override |
156 | | -public int hashCode() { |
157 | | -final int prime = 31; |
158 | | -int result = 1; |
159 | | -result = prime * result + ((country == null) ? 0 : country.hashCode()); |
160 | | -result = prime * result + ((formatted == null) ? 0 : formatted.hashCode()); |
161 | | -result = prime * result + ((id == null) ? 0 : id.hashCode()); |
162 | | -result = prime * result + ((locality == null) ? 0 : locality.hashCode()); |
163 | | -result = prime * result + ((postalCode == null) ? 0 : postalCode.hashCode()); |
164 | | -result = prime * result + ((region == null) ? 0 : region.hashCode()); |
165 | | -result = prime * result + ((streetAddress == null) ? 0 : streetAddress.hashCode()); |
166 | | -return result; |
167 | | -} |
168 | | - |
169 | | -/* (non-Javadoc) |
170 | | - * @see java.lang.Object#equals(java.lang.Object) |
171 | | - */ |
172 | | -@Override |
173 | | -public boolean equals(Object obj) { |
174 | | -if (this == obj) { |
175 | | -return true; |
176 | | -} |
177 | | -if (obj == null) { |
178 | | -return false; |
179 | | -} |
180 | | -if (!(obj instanceof Address)) { |
181 | | -return false; |
182 | | -} |
183 | | -Address other = (Address) obj; |
184 | | -if (country == null) { |
185 | | -if (other.country != null) { |
186 | | -return false; |
187 | | -} |
188 | | -} else if (!country.equals(other.country)) { |
189 | | -return false; |
190 | | -} |
191 | | -if (formatted == null) { |
192 | | -if (other.formatted != null) { |
193 | | -return false; |
194 | | -} |
195 | | -} else if (!formatted.equals(other.formatted)) { |
196 | | -return false; |
197 | | -} |
198 | | -if (id == null) { |
199 | | -if (other.id != null) { |
200 | | -return false; |
201 | | -} |
202 | | -} else if (!id.equals(other.id)) { |
203 | | -return false; |
204 | | -} |
205 | | -if (locality == null) { |
206 | | -if (other.locality != null) { |
207 | | -return false; |
208 | | -} |
209 | | -} else if (!locality.equals(other.locality)) { |
210 | | -return false; |
211 | | -} |
212 | | -if (postalCode == null) { |
213 | | -if (other.postalCode != null) { |
214 | | -return false; |
215 | | -} |
216 | | -} else if (!postalCode.equals(other.postalCode)) { |
217 | | -return false; |
218 | | -} |
219 | | -if (region == null) { |
220 | | -if (other.region != null) { |
221 | | -return false; |
222 | | -} |
223 | | -} else if (!region.equals(other.region)) { |
224 | | -return false; |
225 | | -} |
226 | | -if (streetAddress == null) { |
227 | | -if (other.streetAddress != null) { |
228 | | -return false; |
229 | | -} |
230 | | -} else if (!streetAddress.equals(other.streetAddress)) { |
231 | | -return false; |
232 | | -} |
233 | | -return true; |
234 | | -} |
| 81 | +public void setCountry(String country); |
235 | 82 |
|
236 | 83 | } |
0 commit comments