1 /***
2 Copyright (C) 2005 The Java Community
3
4 This program is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free Software
6 Foundation; either version 2 of the License, or (at your option) any later
7 version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 Place, Suite 330, Boston, MA 02111-1307 USA.
16 */
17 package org.bejug.javacareers.jobs.model;
18
19 import org.apache.commons.lang.builder.CompareToBuilder;
20 import org.apache.commons.lang.builder.EqualsBuilder;
21 import org.apache.commons.lang.builder.HashCodeBuilder;
22 import org.apache.commons.lang.builder.ToStringBuilder;
23
24 /***
25 *
26 * @author Sven Schauwvliege (Last modified by $Author: shally $)
27 * @version $Revision: 1.3 $ - $Date: 2005/12/20 15:36:45 $
28 */
29
30
31 public class Region extends AbstractPersistableObject {
32
33 /***
34 * constructor
35 * @param region name
36 */
37 public Region(String region) {
38 this.name = region;
39 }
40
41 /***
42 * constructor.
43 */
44 public Region() {
45
46 }
47
48 /***
49 * the name of the region.
50 */
51 private String name;
52
53 /***
54 * the country of the region.
55 */
56 private Country country = new Country();
57
58 /***
59 * @return Returns the country.
60 */
61 public Country getCountry() {
62 return country;
63 }
64 /***
65 * @param country The country to set.
66 */
67 public void setCountry(Country country) {
68 this.country = country;
69 }
70 /***
71 * @return Returns the name.
72 */
73 public String getName() {
74 return name;
75 }
76 /***
77 * @param name The name to set.
78 */
79 public void setName(String name) {
80 this.name = name;
81 }
82
83 /***
84 * {@inheritDoc}
85 */
86 public int compareTo(Object o) {
87 Region region = (Region) o;
88 return new CompareToBuilder()
89 .appendSuper(super.compareTo(o))
90 .append(this.name, region.getName())
91
92 .toComparison();
93 }
94
95
96 /***
97 * {@inheritDoc}
98 */
99 public boolean equals(Object o) {
100 if (!(o instanceof Region)) {
101 return false;
102 }
103 if (this == o) {
104 return true;
105 }
106 Region region = (Region) o;
107 return new EqualsBuilder()
108 .appendSuper(super.equals(o))
109 .append(this.name, region.getName())
110
111 .isEquals();
112 }
113
114
115 /***
116 * {@inheritDoc}
117 */
118 public int hashCode() {
119 return new HashCodeBuilder(777, 33)
120 .append(this.name)
121
122 .toHashCode();
123 }
124
125
126 /***
127 * {@inheritDoc}
128 */
129 public String toString() {
130 return new ToStringBuilder(super.toString())
131 .appendSuper("AbstractPersitableObject")
132 .append("name", this.name)
133 .toString();
134 }
135
136 }
137 /***
138 * $Log: Region.java,v $
139 * Revision 1.3 2005/12/20 15:36:45 shally
140 * CheckStyle and PMD changes.
141 *
142 * Revision 1.2 2005/08/31 12:15:09 bme_jcs
143 * refactoring and introduction of apache builders
144 *
145 * Revision 1.1 2005/08/26 07:58:26 ge0ffrey
146 * split up the sources in service, serviceimpl and webclient
147 *
148 * Revision 1.2 2005/08/08 09:38:21 bme_jcs
149 * resolved checkstyle errors
150 *
151 * Revision 1.1 2005/07/05 15:13:11 schauwvliege
152 * added person/contact and location to model
153 *
154 **/