View Javadoc

1   /*
2    * Copyright 2006-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.sample.domain.order;
18  
19  public class Address {
20  	public static final String LINE_ID_BILLING_ADDR = "BAD";
21  
22  	public static final String LINE_ID_SHIPPING_ADDR = "SAD";
23  
24  	private String addressee;
25  
26  	private String addrLine1;
27  
28  	private String addrLine2;
29  
30  	private String city;
31  
32  	private String zipCode;
33  
34  	private String state;
35  
36  	private String country;
37  
38  	public String getAddrLine1() {
39  		return addrLine1;
40  	}
41  
42  	public void setAddrLine1(String addrLine1) {
43  		this.addrLine1 = addrLine1;
44  	}
45  
46  	public String getAddrLine2() {
47  		return addrLine2;
48  	}
49  
50  	public void setAddrLine2(String addrLine2) {
51  		this.addrLine2 = addrLine2;
52  	}
53  
54  	public String getAddressee() {
55  		return addressee;
56  	}
57  
58  	public void setAddressee(String addressee) {
59  		this.addressee = addressee;
60  	}
61  
62  	public String getCity() {
63  		return city;
64  	}
65  
66  	public void setCity(String city) {
67  		this.city = city;
68  	}
69  
70  	public String getCountry() {
71  		return country;
72  	}
73  
74  	public void setCountry(String country) {
75  		this.country = country;
76  	}
77  
78  	public String getState() {
79  		return state;
80  	}
81  
82  	public void setState(String state) {
83  		this.state = state;
84  	}
85  
86  	public String getZipCode() {
87  		return zipCode;
88  	}
89  
90  	public void setZipCode(String zipCode) {
91  		this.zipCode = zipCode;
92  	}
93  
94  	@Override
95  	public String toString() {
96  		return "Address [addressee=" + addressee + ", city=" + city + ", country=" + country + ", state=" + state
97  				+ ", zipCode=" + zipCode + "]";
98  	}
99  
100 	@Override
101 	public int hashCode() {
102 		final int prime = 31;
103 		int result = 1;
104 		result = prime * result + ((addressee == null) ? 0 : addressee.hashCode());
105 		result = prime * result + ((country == null) ? 0 : country.hashCode());
106 		result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode());
107 		return result;
108 	}
109 
110 	@Override
111 	public boolean equals(Object obj) {
112 		if (this == obj)
113 			return true;
114 		if (obj == null)
115 			return false;
116 		if (getClass() != obj.getClass())
117 			return false;
118 		Address other = (Address) obj;
119 		if (addressee == null) {
120 			if (other.addressee != null)
121 				return false;
122 		}
123 		else if (!addressee.equals(other.addressee))
124 			return false;
125 		if (country == null) {
126 			if (other.country != null)
127 				return false;
128 		}
129 		else if (!country.equals(other.country))
130 			return false;
131 		if (zipCode == null) {
132 			if (other.zipCode != null)
133 				return false;
134 		}
135 		else if (!zipCode.equals(other.zipCode))
136 			return false;
137 		return true;
138 	}
139 
140 }