KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > entity > interfaces > TestEntityValue


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

4 package org.jboss.test.entity.interfaces;
5
6 import java.util.*;
7
8 /**
9  * Value object for TestEntity.
10  *
11  */

12 public class TestEntityValue
13    extends
14 java.lang.Object JavaDoc
15    implements java.io.Serializable JavaDoc
16 {
17    private java.lang.String JavaDoc entityID;
18    private boolean entityIDHasBeenSet = false;
19    private java.lang.String JavaDoc value1;
20    private boolean value1HasBeenSet = false;
21
22    private java.lang.String JavaDoc pk;
23
24    public TestEntityValue()
25    {
26    }
27
28    public TestEntityValue( java.lang.String JavaDoc entityID,java.lang.String JavaDoc value1 )
29    {
30       this.entityID = entityID;
31       entityIDHasBeenSet = true;
32       this.value1 = value1;
33       value1HasBeenSet = true;
34       pk = this.getEntityID();
35    }
36
37    //TODO Cloneable is better than this !
38
public TestEntityValue( TestEntityValue otherValue )
39    {
40       this.entityID = otherValue.entityID;
41       entityIDHasBeenSet = true;
42       this.value1 = otherValue.value1;
43       value1HasBeenSet = true;
44
45       pk = this.getEntityID();
46    }
47
48    public java.lang.String JavaDoc getPrimaryKey()
49    {
50       return pk;
51    }
52
53    public void setPrimaryKey( java.lang.String JavaDoc pk )
54    {
55       // it's also nice to update PK object - just in case
56
// somebody would ask for it later...
57
this.pk = pk;
58       setEntityID( pk );
59    }
60
61    public java.lang.String JavaDoc getEntityID()
62    {
63       return this.entityID;
64    }
65
66    public void setEntityID( java.lang.String JavaDoc entityID )
67    {
68       this.entityID = entityID;
69       entityIDHasBeenSet = true;
70
71           pk = entityID;
72    }
73
74    public boolean entityIDHasBeenSet(){
75       return entityIDHasBeenSet;
76    }
77    public java.lang.String JavaDoc getValue1()
78    {
79       return this.value1;
80    }
81
82    public void setValue1( java.lang.String JavaDoc value1 )
83    {
84       this.value1 = value1;
85       value1HasBeenSet = true;
86
87    }
88
89    public boolean value1HasBeenSet(){
90       return value1HasBeenSet;
91    }
92
93    public String JavaDoc toString()
94    {
95       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
96
97       str.append("entityID=" + getEntityID() + " " + "value1=" + getValue1());
98       str.append('}');
99
100       return(str.toString());
101    }
102
103    /**
104     * 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.
105     *
106     * @return true if this instance has an identity.
107     */

108    protected boolean hasIdentity()
109    {
110       return entityIDHasBeenSet;
111    }
112
113    public boolean equals(Object JavaDoc other)
114    {
115       if (this == other)
116          return true;
117       if ( ! hasIdentity() ) return false;
118       if (other instanceof TestEntityValue)
119       {
120          TestEntityValue that = (TestEntityValue) other;
121          if ( ! that.hasIdentity() ) return false;
122          boolean lEquals = true;
123
124          lEquals = lEquals && isIdentical(that);
125
126          return lEquals;
127       }
128       else
129       {
130          return false;
131       }
132    }
133
134    public boolean isIdentical(Object JavaDoc other)
135    {
136       if (other instanceof TestEntityValue)
137       {
138          TestEntityValue that = (TestEntityValue) other;
139          boolean lEquals = true;
140          if( this.entityID == null )
141          {
142             lEquals = lEquals && ( that.entityID == null );
143          }
144          else
145          {
146             lEquals = lEquals && this.entityID.equals( that.entityID );
147          }
148          if( this.value1 == null )
149          {
150             lEquals = lEquals && ( that.value1 == null );
151          }
152          else
153          {
154             lEquals = lEquals && this.value1.equals( that.value1 );
155          }
156
157          return lEquals;
158       }
159       else
160       {
161          return false;
162       }
163    }
164
165    public int hashCode(){
166       int result = 17;
167       result = 37*result + ((this.entityID != null) ? this.entityID.hashCode() : 0);
168
169       result = 37*result + ((this.value1 != null) ? this.value1.hashCode() : 0);
170
171       return result;
172    }
173
174 }
175
Popular Tags