001/* 002 * Copyright 2006-2014 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.batch.sample.domain.order; 018 019public class Address { 020 public static final String LINE_ID_BILLING_ADDR = "BAD"; 021 022 public static final String LINE_ID_SHIPPING_ADDR = "SAD"; 023 024 private String addressee; 025 026 private String addrLine1; 027 028 private String addrLine2; 029 030 private String city; 031 032 private String zipCode; 033 034 private String state; 035 036 private String country; 037 038 public String getAddrLine1() { 039 return addrLine1; 040 } 041 042 public void setAddrLine1(String addrLine1) { 043 this.addrLine1 = addrLine1; 044 } 045 046 public String getAddrLine2() { 047 return addrLine2; 048 } 049 050 public void setAddrLine2(String addrLine2) { 051 this.addrLine2 = addrLine2; 052 } 053 054 public String getAddressee() { 055 return addressee; 056 } 057 058 public void setAddressee(String addressee) { 059 this.addressee = addressee; 060 } 061 062 public String getCity() { 063 return city; 064 } 065 066 public void setCity(String city) { 067 this.city = city; 068 } 069 070 public String getCountry() { 071 return country; 072 } 073 074 public void setCountry(String country) { 075 this.country = country; 076 } 077 078 public String getState() { 079 return state; 080 } 081 082 public void setState(String state) { 083 this.state = state; 084 } 085 086 public String getZipCode() { 087 return zipCode; 088 } 089 090 public void setZipCode(String zipCode) { 091 this.zipCode = zipCode; 092 } 093 094 @Override 095 public String toString() { 096 return "Address [addressee=" + addressee + ", city=" + city + ", country=" + country + ", state=" + state 097 + ", zipCode=" + zipCode + "]"; 098 } 099 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 } 115 if (obj == null) { 116 return false; 117 } 118 if (getClass() != obj.getClass()) { 119 return false; 120 } 121 Address other = (Address) obj; 122 if (addressee == null) { 123 if (other.addressee != null) { 124 return false; 125 } 126 } 127 else if (!addressee.equals(other.addressee)) { 128 return false; 129 } 130 if (country == null) { 131 if (other.country != null) { 132 return false; 133 } 134 } 135 else if (!country.equals(other.country)) { 136 return false; 137 } 138 if (zipCode == null) { 139 if (other.zipCode != null) { 140 return false; 141 } 142 } 143 else if (!zipCode.equals(other.zipCode)) { 144 return false; 145 } 146 147 return true; 148 } 149}