KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > interfaces > AccountValue


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

4 package test.interfaces;
5
6 /**
7  * Value object for Account.
8  *
9  * Notice, this object is used to represent the state of an
10  * Account 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 AccountValue
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 float totalBalance;
28    private boolean totalBalanceHasBeenSet = false;
29
30    private float balance;
31    private boolean balanceHasBeenSet = false;
32
33    private java.lang.String JavaDoc accountId;
34    private boolean accountIdHasBeenSet = false;
35    private test.interfaces.CustomerNormalValue OwnerNormalValue;
36    private boolean OwnerNormalValueHasBeenSet = false;
37
38    private test.interfaces.AccountPK primaryKey;
39
40    public AccountValue()
41    {
42       primaryKey = new test.interfaces.AccountPK();
43    }
44
45    public AccountValue( java.lang.Integer JavaDoc id,float totalBalance,float balance,java.lang.String JavaDoc accountId )
46    {
47        setId(id);
48        setTotalBalance(totalBalance);
49        setBalance(balance);
50        setAccountId(accountId);
51        primaryKey = new test.interfaces.AccountPK(this.getId());
52    }
53
54    /**
55     * @deprecated use {@link #clone}
56     */

57    public AccountValue( AccountValue otherValue )
58    {
59       this.id = otherValue.id;
60       idHasBeenSet = true;
61       this.totalBalance = otherValue.totalBalance;
62       totalBalanceHasBeenSet = true;
63       this.balance = otherValue.balance;
64       balanceHasBeenSet = true;
65       this.accountId = otherValue.accountId;
66       accountIdHasBeenSet = true;
67       this.OwnerNormalValue = otherValue.OwnerNormalValue;
68       OwnerNormalValueHasBeenSet = true;
69
70       primaryKey = new test.interfaces.AccountPK(this.getId());
71    }
72
73    public test.interfaces.AccountPK getPrimaryKey()
74    {
75       return primaryKey;
76    }
77
78    public void setPrimaryKey( test.interfaces.AccountPK primaryKey)
79    {
80       // it's also nice to update PK object - just in case
81
// somebody would ask for it later...
82
this.primaryKey = primaryKey;
83       setId( primaryKey.id );
84    }
85
86    public java.lang.Integer JavaDoc getId()
87    {
88       return this.id;
89    }
90
91    public void setId( java.lang.Integer JavaDoc id )
92    {
93       this.id = id;
94       idHasBeenSet = true;
95
96       primaryKey.setId(id);
97    }
98
99    public boolean idHasBeenSet(){
100       return idHasBeenSet;
101    }
102    public float getTotalBalance()
103    {
104       return this.totalBalance;
105    }
106
107    private void setTotalBalance( float totalBalance )
108    {
109       this.totalBalance = totalBalance;
110       totalBalanceHasBeenSet = true;
111
112    }
113
114    public float getBalance()
115    {
116       return this.balance;
117    }
118
119    public void setBalance( float balance )
120    {
121       this.balance = balance;
122       balanceHasBeenSet = true;
123
124    }
125
126    public boolean balanceHasBeenSet(){
127       return balanceHasBeenSet;
128    }
129    public java.lang.String JavaDoc getAccountId()
130    {
131       return this.accountId;
132    }
133
134    private void setAccountId( java.lang.String JavaDoc accountId )
135    {
136       this.accountId = accountId;
137       accountIdHasBeenSet = true;
138
139    }
140
141    public test.interfaces.CustomerNormalValue getOwnerNormalValue()
142    {
143       return this.OwnerNormalValue;
144    }
145    public void setOwnerNormalValue( test.interfaces.CustomerNormalValue OwnerNormalValue )
146    {
147       this.OwnerNormalValue = OwnerNormalValue;
148       OwnerNormalValueHasBeenSet = true;
149    }
150    public boolean ownerNormalValueHasBeenSet()
151    {
152       return OwnerNormalValueHasBeenSet;
153    }
154
155    public String JavaDoc toString()
156    {
157       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
158
159       str.append("id=" + getId() + " " + "totalBalance=" + getTotalBalance() + " " + "balance=" + getBalance() + " " + "accountId=" + getAccountId());
160       str.append('}');
161
162       return(str.toString());
163    }
164
165    /**
166     * 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.
167     *
168     * @return true if this instance has an identity.
169     */

170    protected boolean hasIdentity()
171    {
172       boolean ret = true;
173       ret = ret && idHasBeenSet;
174       return ret;
175    }
176
177    /**
178     *
179     * @deprecated use {@link #equals}
180     */

181    public boolean isIdentical(Object JavaDoc other)
182    {
183           if (other instanceof AccountValue)
184           {
185                  AccountValue that = (AccountValue) other;
186                  boolean lEquals = true;
187                  lEquals = lEquals && this.totalBalance == that.totalBalance;
188                  lEquals = lEquals && this.balance == that.balance;
189                  if( this.accountId == null )
190                  {
191                         lEquals = lEquals && ( that.accountId == null );
192                  }
193                  else
194                  {
195                         lEquals = lEquals && this.accountId.equals( that.accountId );
196                  }
197                  if( this.OwnerNormalValue == null )
198                  {
199                         lEquals = lEquals && ( that.OwnerNormalValue == null );
200                  }
201                  else
202                  {
203                         lEquals = lEquals && this.OwnerNormalValue.equals( that.OwnerNormalValue );
204                  }
205
206                  return lEquals;
207           }
208           else
209           {
210                  return false;
211           }
212    }
213
214     public boolean equals(Object JavaDoc other) {
215
216         //If it's not the correct type, clearly it isn't equal to this.
217
if (!(other instanceof AccountValue)) {
218             return false;
219         }
220
221         return equals((AccountValue) other);
222     }
223
224     /**
225      * This class is not using strict ordering. This means that the object is not Comparable, and
226      * each check for equality will test all members for equality. We do not check collections for
227      * equality however, so you would be wise to not use this if you have collection typed EJB References.
228      */

229     public boolean equals(AccountValue that) {
230
231         //try to get lucky.
232
if (this == that) {
233             return true;
234         }
235         //this clearly isn't null.
236
if(null == that) {
237             return false;
238         }
239
240         if(this.id != that.id) {
241
242             if( this.id == null || that.id == null ) {
243                 return false;
244             }
245
246             if(!this.id.equals(that.id)) {
247                 return false;
248             }
249
250         }
251
252         if(this.totalBalance != that.totalBalance) {
253             return false;
254         }
255
256         if(this.balance != that.balance) {
257             return false;
258         }
259
260         if(this.accountId != that.accountId) {
261
262             if( this.accountId == null || that.accountId == null ) {
263                 return false;
264             }
265
266             if(!this.accountId.equals(that.accountId)) {
267                 return false;
268             }
269
270         }
271
272          if(this.OwnerNormalValue != that.OwnerNormalValue) {
273             if((this.OwnerNormalValue == null) || (that.OwnerNormalValue == null)) {
274                 return false;
275             }
276             if(!this.OwnerNormalValue.equals(that.OwnerNormalValue)) {
277                 return false;
278             }
279          }
280
281         return true;
282
283     }
284
285     public Object JavaDoc clone() throws java.lang.CloneNotSupportedException JavaDoc {
286         AccountValue other = (AccountValue) super.clone();
287
288         return other;
289     }
290
291     public ReadOnlyAccountValue getReadOnlyAccountValue() {
292         return new ReadOnlyAccountValue();
293     }
294
295     public int hashCode(){
296       int result = 17;
297       result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
298
299       result = 37*result + Float.floatToIntBits(totalBalance);
300
301       result = 37*result + Float.floatToIntBits(balance);
302
303       result = 37*result + ((this.accountId != null) ? this.accountId.hashCode() : 0);
304
305       result = 37*result + ((this.OwnerNormalValue != null) ? this.OwnerNormalValue.hashCode() : 0);
306
307       return result;
308     }
309
310     /**
311      * Covariant function so the compiler can choose the proper one at compile time,
312      * eliminates the need for XDoclet to really understand compiletime typing.
313      *
314      * Read only collections need to be synchronized. Once we start giving out handles
315      * to these collections, they'll be used in other threads sooner or later.
316      */

317     private static java.util.Collection JavaDoc wrapCollection(java.util.Collection JavaDoc input) {
318         return java.util.Collections.synchronizedCollection(input);
319     }
320     /**
321      * Covariant function so the compiler can choose the proper one at compile time,
322      * eliminates the need for XDoclet to really understand compiletime typing.
323      *
324      * Read only collections need to be synchronized. Once we start giving out handles
325      * to these collections, they'll be used in other threads sooner or later.
326      */

327     private static java.util.Set JavaDoc wrapCollection(java.util.Set JavaDoc input) {
328         return java.util.Collections.synchronizedSet(input);
329     }
330     /**
331      * Covariant function. This is used in covariant form so that the compiler
332      * can do some of our conditional branches for us. If I made these functions
333      * have different names, then XDoclet would have to choose between them based on
334      * compiletime types, that wouldn't be easy.
335      */

336     private static java.util.Collection JavaDoc wrapReadOnly(java.util.Collection JavaDoc input) {
337         return java.util.Collections.unmodifiableCollection(input);
338     }
339     /**
340      * Covariant function. This is used in covariant form so that the compiler
341      * can do some of our conditional branches for us. If I made these functions
342      * have different names, then XDoclet would have to choose between them based on
343      * compiletime types, that wouldn't be easy.
344      */

345     private static java.util.Set JavaDoc wrapReadOnly(java.util.Set JavaDoc input) {
346         return java.util.Collections.unmodifiableSet(input);
347     }
348
349     private final class ReadOnlyAccountValue
350     implements java.lang.Cloneable JavaDoc, java.io.Serializable JavaDoc
351     {
352         private AccountValue underlying() {
353             return AccountValue.this;
354         }
355
356        public java.lang.Integer JavaDoc getId() {
357               return underlying().id;
358        }
359
360        public float getTotalBalance() {
361               return underlying().totalBalance;
362        }
363
364        public float getBalance() {
365               return underlying().balance;
366        }
367
368        public java.lang.String JavaDoc getAccountId() {
369               return underlying().accountId;
370        }
371
372        public test.interfaces.CustomerNormalValue getOwnerNormalValue()
373        {
374               return underlying().OwnerNormalValue;
375        }
376
377         public int hashCode() {
378             return 101 * underlying().hashCode();
379         }
380
381         public boolean equals(Object JavaDoc o) {
382             if(o instanceof ReadOnlyAccountValue) {
383                 return this.equals((ReadOnlyAccountValue) o);
384             }
385             return false;
386         }
387
388         public boolean equals(ReadOnlyAccountValue that) {
389             if(null == that) {
390                 return false;
391             }
392
393             return this.underlying().equals(that.underlying());
394         }
395
396     }
397
398 }
399
Popular Tags