KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > GuidTestEntity


1 package org.apache.ojb.broker;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.Date JavaDoc;
5
6 import org.apache.ojb.broker.util.GUID;
7
8 /**
9  * @author tom
10  *
11  * To change this generated comment edit the template variable "typecomment":
12  * Window>Preferences>Java>Templates.
13  * To enable and disable the creation of type comments go to
14  * Window>Preferences>Java>Code Generation.
15  */

16 public class GuidTestEntity implements Serializable JavaDoc
17 {
18     private GUID guid;
19     private String JavaDoc value;
20     
21     /**
22      * Constructor for GuidTestEntity.
23      */

24     public GuidTestEntity()
25     {
26         super();
27         guid = new GUID();
28         value = new Date JavaDoc().toString();
29     }
30
31     /**
32      * Returns the guid.
33      * @return GUID
34      */

35     public GUID getGuid()
36     {
37         return guid;
38     }
39
40     /**
41      * Returns the value.
42      * @return String
43      */

44     public String JavaDoc getValue()
45     {
46         return value;
47     }
48
49     /**
50      * Sets the guid.
51      * @param guid The guid to set
52      */

53     public void setGuid(GUID guid)
54     {
55         this.guid = guid;
56     }
57
58     /**
59      * Sets the value.
60      * @param value The value to set
61      */

62     public void setValue(String JavaDoc value)
63     {
64         this.value = value;
65     }
66
67     /**
68      * @see java.lang.Object#hashCode()
69      */

70     public int hashCode()
71     {
72         return guid.hashCode();
73     }
74
75     /**
76      * @see java.lang.Object#toString()
77      */

78     public String JavaDoc toString()
79     {
80         return guid.toString() + " : " + value;
81     }
82
83     /**
84      * @see java.lang.Object#equals(Object)
85      */

86     public boolean equals(Object JavaDoc obj)
87     {
88         if (obj instanceof GuidTestEntity)
89         {
90             if (((GuidTestEntity) obj).getGuid().equals(this.getGuid()))
91             {
92                 return true;
93             }
94         }
95         return false;
96     }
97
98 }
99
Popular Tags