KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > tests > aop > ValueObject


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.tests.aop;
8
9
10
11 /**
12  * Object to test non-primitive key.
13  */

14 public class ValueObject {
15
16   private IdObject idObj;
17   private float value;
18
19   public ValueObject() {
20   } // ValueObject
21

22   public ValueObject(IdObject aIdObj, float aValue) {
23     idObj = aIdObj;
24     value = aValue;
25   } // ValueObject
26

27   public IdObject getIdObj() {
28     return idObj;
29   }
30
31   public float getValue() {
32     return value;
33   }
34
35   public String JavaDoc toString() {
36     return idObj + ": " + value;
37   } // toString
38

39   public boolean equals(Object JavaDoc aObject) {
40     boolean result = false;
41
42     if ((aObject != null) &&
43          (aObject.getClass().getName().equals( this.getClass().getName()))) {
44       result = idObj.equals(((ValueObject)aObject).idObj);
45     } // if
46

47     return result;
48   } // equals
49

50   public int hashCode() {
51     return idObj.hashCode();
52   } // hashCode
53
} // class ValueObject
54
Popular Tags