KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > ejb > cmr > EmployeeAddressValue


1 /*
2  * Generated by XDoclet - Do not edit!
3  */

4 package test.ejb.cmr;
5
6 /**
7  * Value object for EmployeeAddress.
8  *
9  * Notice, this object is used to represent the state of an
10  * EmployeeAddress object. This value object
11  * Is not connected to the database in any way, it is just a normal object used
12  * as a container for data from an EJB.
13  *
14  * @xdoclet-generated at 16-04-05
15  * @copyright The XDoclet Team
16  * @author XDoclet
17  * @version 1.2.3
18  */

19 public class EmployeeAddressValue
20    extends java.lang.Object JavaDoc
21    implements java.io.Serializable JavaDoc, java.lang.Cloneable JavaDoc
22 {
23
24    private java.lang.Integer JavaDoc id;
25    private boolean idHasBeenSet = false;
26
27    private java.lang.String JavaDoc description;
28    private boolean descriptionHasBeenSet = false;
29
30    private java.lang.Integer JavaDoc primaryKey;
31
32    public EmployeeAddressValue()
33    {
34    }
35
36    public EmployeeAddressValue( java.lang.Integer JavaDoc id,java.lang.String JavaDoc description )
37    {
38        setId(id);
39        setDescription(description);
40        primaryKey = this.getId();
41    }
42
43    /**
44     * @deprecated use {@link #clone}
45     */

46    public EmployeeAddressValue( EmployeeAddressValue otherValue )
47    {
48       this.id = otherValue.id;
49       idHasBeenSet = true;
50       this.description = otherValue.description;
51       descriptionHasBeenSet = true;
52
53       primaryKey = this.getId();
54    }
55
56    public java.lang.Integer JavaDoc getPrimaryKey()
57    {
58       return primaryKey;
59    }
60
61    public void setPrimaryKey( java.lang.Integer JavaDoc primaryKey)
62    {
63       // it's also nice to update PK object - just in case
64
// somebody would ask for it later...
65
this.primaryKey = primaryKey;
66       setId( primaryKey );
67    }
68
69    public java.lang.Integer JavaDoc getId()
70    {
71       return this.id;
72    }
73
74    public void setId( java.lang.Integer JavaDoc id )
75    {
76       this.id = id;
77       idHasBeenSet = true;
78
79       primaryKey = id;
80    }
81
82    public boolean idHasBeenSet(){
83       return idHasBeenSet;
84    }
85    public java.lang.String JavaDoc getDescription()
86    {
87       return this.description;
88    }
89
90    public void setDescription( java.lang.String JavaDoc description )
91    {
92       this.description = description;
93       descriptionHasBeenSet = true;
94
95    }
96
97    public boolean descriptionHasBeenSet(){
98       return descriptionHasBeenSet;
99    }
100
101    public String JavaDoc toString()
102    {
103       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
104
105       str.append("id=" + getId() + " " + "description=" + getDescription());
106       str.append('}');
107
108       return(str.toString());
109    }
110
111    /**
112     * A Value Object has an identity if the attributes making its Primary Key have all been set. An object without identity is never equal to any other object.
113     *
114     * @return true if this instance has an identity.
115     */

116    protected boolean hasIdentity()
117    {
118       return idHasBeenSet;
119    }
120
121    /**
122     *
123     * @deprecated use {@link #equals}
124     */

125    public boolean isIdentical(Object JavaDoc other)
126    {
127           if (other instanceof EmployeeAddressValue)
128           {
129                  EmployeeAddressValue that = (EmployeeAddressValue) other;
130                  boolean lEquals = true;
131                  if( this.id == null )
132                  {
133                         lEquals = lEquals && ( that.id == null );
134                  }
135                  else
136                  {
137                         lEquals = lEquals && this.id.equals( that.id );
138                  }
139                  if( this.description == null )
140                  {
141                         lEquals = lEquals && ( that.description == null );
142                  }
143                  else
144                  {
145                         lEquals = lEquals && this.description.equals( that.description );
146                  }
147
148                  return lEquals;
149           }
150           else
151           {
152                  return false;
153           }
154    }
155
156     public boolean equals(Object JavaDoc other) {
157
158         //If it's not the correct type, clearly it isn't equal to this.
159
if (!(other instanceof EmployeeAddressValue)) {
160             return false;
161         }
162
163         return equals((EmployeeAddressValue) other);
164     }
165
166     /**
167      * This class is not using strict ordering. This means that the object is not Comparable, and
168      * each check for equality will test all members for equality. We do not check collections for
169      * equality however, so you would be wise to not use this if you have collection typed EJB References.
170      */

171     public boolean equals(EmployeeAddressValue that) {
172
173         //try to get lucky.
174
if (this == that) {
175             return true;
176         }
177         //this clearly isn't null.
178
if(null == that) {
179             return false;
180         }
181
182         if(this.id != that.id) {
183
184             if( this.id == null || that.id == null ) {
185                 return false;
186             }
187
188             if(!this.id.equals(that.id)) {
189                 return false;
190             }
191
192         }
193
194         if(this.description != that.description) {
195
196             if( this.description == null || that.description == null ) {
197                 return false;
198             }
199
200             if(!this.description.equals(that.description)) {
201                 return false;
202             }
203
204         }
205
206         return true;
207
208     }
209
210     public Object JavaDoc clone() throws java.lang.CloneNotSupportedException JavaDoc {
211         EmployeeAddressValue other = (EmployeeAddressValue) super.clone();
212
213         return other;
214     }
215
216     public ReadOnlyEmployeeAddressValue getReadOnlyEmployeeAddressValue() {
217         return new ReadOnlyEmployeeAddressValue();
218     }
219
220     public int hashCode(){
221       int result = 17;
222       result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
223
224       result = 37*result + ((this.description != null) ? this.description.hashCode() : 0);
225
226       return result;
227     }
228
229     /**
230      * Covariant function so the compiler can choose the proper one at compile time,
231      * eliminates the need for XDoclet to really understand compiletime typing.
232      *
233      * Read only collections need to be synchronized. Once we start giving out handles
234      * to these collections, they'll be used in other threads sooner or later.
235      */

236     private static java.util.Collection JavaDoc wrapCollection(java.util.Collection JavaDoc input) {
237         return java.util.Collections.synchronizedCollection(input);
238     }
239     /**
240      * Covariant function so the compiler can choose the proper one at compile time,
241      * eliminates the need for XDoclet to really understand compiletime typing.
242      *
243      * Read only collections need to be synchronized. Once we start giving out handles
244      * to these collections, they'll be used in other threads sooner or later.
245      */

246     private static java.util.Set JavaDoc wrapCollection(java.util.Set JavaDoc input) {
247         return java.util.Collections.synchronizedSet(input);
248     }
249     /**
250      * Covariant function. This is used in covariant form so that the compiler
251      * can do some of our conditional branches for us. If I made these functions
252      * have different names, then XDoclet would have to choose between them based on
253      * compiletime types, that wouldn't be easy.
254      */

255     private static java.util.Collection JavaDoc wrapReadOnly(java.util.Collection JavaDoc input) {
256         return java.util.Collections.unmodifiableCollection(input);
257     }
258     /**
259      * Covariant function. This is used in covariant form so that the compiler
260      * can do some of our conditional branches for us. If I made these functions
261      * have different names, then XDoclet would have to choose between them based on
262      * compiletime types, that wouldn't be easy.
263      */

264     private static java.util.Set JavaDoc wrapReadOnly(java.util.Set JavaDoc input) {
265         return java.util.Collections.unmodifiableSet(input);
266     }
267
268     private final class ReadOnlyEmployeeAddressValue
269     implements java.lang.Cloneable JavaDoc, java.io.Serializable JavaDoc
270     {
271         private EmployeeAddressValue underlying() {
272             return EmployeeAddressValue.this;
273         }
274
275        public java.lang.Integer JavaDoc getId() {
276               return underlying().id;
277        }
278
279        public java.lang.String JavaDoc getDescription() {
280               return underlying().description;
281        }
282
283         public int hashCode() {
284             return 101 * underlying().hashCode();
285         }
286
287         public boolean equals(Object JavaDoc o) {
288             if(o instanceof ReadOnlyEmployeeAddressValue) {
289                 return this.equals((ReadOnlyEmployeeAddressValue) o);
290             }
291             return false;
292         }
293
294         public boolean equals(ReadOnlyEmployeeAddressValue that) {
295             if(null == that) {
296                 return false;
297             }
298
299             return this.underlying().equals(that.underlying());
300         }
301
302     }
303
304 }
305
Popular Tags