Source Code Cross Referenced for Widget.java in  » Database-ORM » TJDO » com » triactive » jdo » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » TJDO » com.triactive.jdo.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002 (C) TJDO.
003:         * All rights reserved.
004:         *
005:         * This software is distributed under the terms of the TJDO License version 1.0.
006:         * See the terms of the TJDO License in the documentation provided with this software.
007:         *
008:         * $Id: Widget.java,v 1.4 2003/03/17 07:02:53 jackknifebarber Exp $
009:         */
010:
011:        package com.triactive.jdo.test;
012:
013:        import javax.jdo.InstanceCallbacks;
014:
015:        public class Widget extends TestObject implements  InstanceCallbacks {
016:            private boolean booleanField;
017:            private Boolean booleanObjField;
018:            private byte byteField;
019:            private Byte byteObjField;
020:            private char charField;
021:            private Character charObjField;
022:            private short shortField;
023:            private Short shortObjField;
024:            private int intField;
025:            private Integer intObjField;
026:            private long longField;
027:            private Long longObjField;
028:
029:            public Widget() {
030:            }
031:
032:            public boolean getBooleanField() {
033:                return booleanField;
034:            }
035:
036:            public Boolean getBooleanObjField() {
037:                return booleanObjField;
038:            }
039:
040:            public byte getByteField() {
041:                return byteField;
042:            }
043:
044:            public Byte getByteObjField() {
045:                return byteObjField;
046:            }
047:
048:            public char getCharField() {
049:                return charField;
050:            }
051:
052:            public Character getCharObjField() {
053:                return charObjField;
054:            }
055:
056:            public short getShortField() {
057:                return shortField;
058:            }
059:
060:            public Short getShortObjField() {
061:                return shortObjField;
062:            }
063:
064:            public int getIntField() {
065:                return intField;
066:            }
067:
068:            public Integer getIntObjField() {
069:                return intObjField;
070:            }
071:
072:            public long getLongField() {
073:                return longField;
074:            }
075:
076:            public Long getLongObjField() {
077:                return longObjField;
078:            }
079:
080:            public void setByteField(byte byteField) {
081:                this .byteField = byteField;
082:            }
083:
084:            public void setShortField(short shortField) {
085:                this .shortField = shortField;
086:            }
087:
088:            public void setIntField(int intField) {
089:                this .intField = intField;
090:            }
091:
092:            public byte setByteFieldRandom() {
093:                byte b = nextByte();
094:
095:                this .byteField = b;
096:
097:                return b;
098:            }
099:
100:            /**
101:             * Fills all of the object's fields with random data values.  Any non-
102:             * primitive fields (with the exception of <code>id</code>) will also be
103:             * assigned <code>null</code> on a random basis.
104:             */
105:
106:            public void fillRandom() {
107:                booleanField = r.nextBoolean();
108:                booleanObjField = nextNull() ? null : new Boolean(r
109:                        .nextBoolean());
110:                byteField = nextByte();
111:                byteObjField = nextNull() ? null : new Byte(nextByte());
112:                charField = nextCharacter();
113:                charObjField = nextNull() ? null : new Character(
114:                        nextCharacter());
115:                shortField = (short) (r.nextInt(Short.MAX_VALUE * 2) - Short.MAX_VALUE);
116:                shortObjField = nextNull() ? null : new Short((short) (r
117:                        .nextInt(Short.MAX_VALUE * 2) - Short.MAX_VALUE));
118:                intField = r.nextInt();
119:                intObjField = nextNull() ? null : new Integer(r.nextInt());
120:                longField = r.nextLong();
121:                longObjField = nextNull() ? null : new Long(r.nextLong());
122:            }
123:
124:            /**
125:             * Indicates whether some other object is "equal to" this one.  By comparing
126:             * against an original copy of the object, <code>compareTo()</code> can be
127:             * used to verify that the object has been written to a database and read
128:             * back correctly.
129:             *
130:             * @param   obj     the reference object with which to compare
131:             *
132:             * @return  <code>true</code> if this object is equal to the obj argument;
133:             *          <code>false</code> otherwise.
134:             */
135:
136:            public boolean compareTo(Object obj) {
137:                if (obj == this )
138:                    return true;
139:
140:                if (!(obj instanceof  Widget))
141:                    return false;
142:
143:                Widget w = (Widget) obj;
144:
145:                if (booleanObjField == null) {
146:                    if (w.booleanObjField != null)
147:                        return false;
148:                } else if (!booleanObjField.equals(w.booleanObjField))
149:                    return false;
150:
151:                if (byteObjField == null) {
152:                    if (w.byteObjField != null)
153:                        return false;
154:                } else if (!byteObjField.equals(w.byteObjField))
155:                    return false;
156:
157:                if (charObjField == null) {
158:                    if (w.charObjField != null)
159:                        return false;
160:                } else if (!charObjField.equals(w.charObjField))
161:                    return false;
162:
163:                if (shortObjField == null) {
164:                    if (w.shortObjField != null)
165:                        return false;
166:                } else if (!shortObjField.equals(w.shortObjField))
167:                    return false;
168:
169:                if (intObjField == null) {
170:                    if (w.intObjField != null)
171:                        return false;
172:                } else if (!intObjField.equals(w.intObjField))
173:                    return false;
174:
175:                if (longObjField == null) {
176:                    if (w.longObjField != null)
177:                        return false;
178:                } else if (!longObjField.equals(w.longObjField))
179:                    return false;
180:
181:                return booleanField == w.booleanField
182:                        && byteField == w.byteField && charField == w.charField
183:                        && shortField == w.shortField && intField == w.intField
184:                        && longField == w.longField;
185:            }
186:
187:            /**
188:             * Returns a string representation for this object.  All of the field
189:             * values are included in the string for debugging purposes.
190:             *
191:             * @return  a string representation for this object.
192:             */
193:
194:            public String toString() {
195:                StringBuffer s = new StringBuffer(super .toString());
196:
197:                s.append("  booleanField = ").append(booleanField);
198:                s.append('\n');
199:                s.append("  booleanObjField = ").append(booleanObjField);
200:                s.append('\n');
201:                s.append("  byteField = ").append(byteField);
202:                s.append('\n');
203:                s.append("  byteObjField = ").append(byteObjField);
204:                s.append('\n');
205:                s.append("  charField = ").append(charField);
206:                s.append('\n');
207:                s.append("  charObjField = ").append(charObjField);
208:                s.append('\n');
209:                s.append("  shortField = ").append(shortField);
210:                s.append('\n');
211:                s.append("  shortObjField = ").append(shortObjField);
212:                s.append('\n');
213:                s.append("  intField = ").append(intField);
214:                s.append('\n');
215:                s.append("  intObjField = ").append(intObjField);
216:                s.append('\n');
217:                s.append("  longField = ").append(longField);
218:                s.append('\n');
219:                s.append("  longObjField = ").append(longObjField);
220:                s.append('\n');
221:
222:                return s.toString();
223:            }
224:
225:            public void jdoPostLoad() {
226:            }
227:
228:            public void jdoPreClear() {
229:            }
230:
231:            public void jdoPreDelete() {
232:            }
233:
234:            public void jdoPreStore() {
235:                /*
236:                 * This is here for the benefit of one particular test in
237:                 * BasicStorageTest.updateObjects(), which tests the updating of
238:                 * a default-fetch-group field when the default fetch group has not
239:                 * been loaded.  All it needs to do is touch a couple of DFG fields.
240:                 */
241:                if (booleanField && intField < 0)
242:                    nextCharacter();
243:            }
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.