View Javadoc

1   /*
2   * Copyright 2005 Arnaud Prost
3   * 
4   * Arnaud.prost@gmail.com
5   * 
6   * This software is a computer program whose purpose is to ease the 
7   * management of software project.
8   * 
9   * This software is governed by the CeCILL  license under French law and
10  * abiding by the rules of distribution of free software.  You can  use, 
11  * modify and/ or redistribute the software under the terms of the CeCILL
12  * license as circulated by CEA, CNRS and INRIA at the following URL
13  * "http://www.cecill.info". 
14  * 
15  * As a counterpart to the access to the source code and  rights to copy,
16  * modify and redistribute granted by the license, users are provided only
17  * with a limited warranty  and the software's author,  the holder of the
18  * economic rights,  and the successive licensors  have only  limited
19  * liability. 
20  * 
21  * In this respect, the user's attention is drawn to the risks associated
22  * with loading,  using,  modifying and/or developing or reproducing the
23  * software by the user in light of its specific status of free software,
24  * that may mean  that it is complicated to manipulate,  and  that  also
25  * therefore means  that it is reserved for developers  and  experienced
26  * professionals having in-depth computer knowledge. Users are therefore
27  * encouraged to load and test the software's suitability as regards their
28  * requirements in conditions enabling the security of their systems and/or 
29  * data to be ensured and,  more generally, to use and operate it in the 
30  * same conditions as regards security. 
31  * 
32  * The fact that you are presently reading this means that you have had
33  * knowledge of the CeCILL license and that you accept its terms.
34  */
35  
36  
37  package net.sf.pmr.core.domain.user.company;
38  
39  import org.apache.commons.lang.builder.EqualsBuilder;
40  import org.apache.commons.lang.builder.HashCodeBuilder;
41  
42  /***
43   * @author Arnaud Prost (arnaud.prost@gmail.com)
44   */
45  public class AddressImpl implements Address {
46  
47      private String country;
48  
49      private String postalCode;
50  
51      private String streetName;
52  
53      private String streetNumber;
54  
55      private String city;
56  
57  
58      /*
59       * (non-Javadoc)
60       *
61       * @see net.sf.pmr.core.domain.user.Address#getCountry()
62       */
63      public String getCountry() {
64          return country;
65  
66      }
67  
68      /*
69       * (non-Javadoc)
70       *
71       * @see net.sf.pmr.core.domain.user.Address#setCountry(java.lang.String)
72       */
73      public void setCountry(final String country) {
74          this.country = country;
75  
76      }
77  
78      /*
79       * (non-Javadoc)
80       *
81       * @see net.sf.pmr.core.domain.user.Address#getPostalCode()
82       */
83      public String getPostalCode() {
84          return postalCode;
85      }
86  
87      /*
88       * (non-Javadoc)
89       *
90       * @see net.sf.pmr.core.domain.user.Address#setPostalCode(java.lang.String)
91       */
92      public void setPostalCode(final String postalCode) {
93          this.postalCode = postalCode;
94      }
95  
96      /*
97       * (non-Javadoc)
98       *
99       * @see net.sf.pmr.core.domain.user.Address#getStreetName()
100      */
101     public String getStreetName() {
102         return streetName;
103     }
104 
105     /*
106      * (non-Javadoc)
107      *
108      * @see net.sf.pmr.core.domain.user.Address#setStreetName(java.lang.String)
109      */
110     public void setStreetName(final String streetName) {
111         this.streetName = streetName;
112 
113     }
114 
115     /*
116      * (non-Javadoc)
117      *
118      * @see net.sf.pmr.core.domain.user.Address#getStreetNumber()
119      */
120     public String getStreetNumber() {
121         return streetNumber;
122     }
123 
124     /*
125      * (non-Javadoc)
126      *
127      * @see net.sf.pmr.core.domain.user.Address#setStreetNumber(java.lang.String)
128      */
129     public void setStreetNumber(final String streetNumber) {
130         this.streetNumber = streetNumber;
131     }
132 
133     /***
134      * @see net.sf.pmr.core.domain.user.company.Address#getCity()
135      */
136     public String getCity() {
137         return city;
138     }
139 
140     /***
141      * @see net.sf.pmr.core.domain.user.company.Address#setCity(java.lang.String)
142      */
143     public void setCity(final String city) {
144         this.city = city;
145     }
146 
147     /***
148      * @see java.lang.Object#equals(Object)
149      */
150     public boolean equals(final Object object) {
151         if (!(object instanceof AddressImpl)) {
152             return false;
153         }
154         AddressImpl rhs = (AddressImpl) object;
155         return new EqualsBuilder().append(this.postalCode, rhs.postalCode)
156                 .append(this.streetName, rhs.streetName).append(this.country,
157                         rhs.country)
158                 .append(this.streetNumber, rhs.streetNumber).append(this.city,
159                         rhs.city).isEquals();
160     }
161 
162     /***
163      * @see java.lang.Object#hashCode()
164      */
165     public int hashCode() {
166         return new HashCodeBuilder(-2032099061, -487020811).append(
167                 this.postalCode).append(this.streetName).append(this.country)
168                 .append(this.streetNumber).append(this.city).toHashCode();
169     }
170 }