Source Code Cross Referenced for Date.java in  » Database-ORM » TJDO » com » triactive » jdo » sco » 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.sco 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004 (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: Date.java,v 1.6 2004/01/18 03:01:06 jackknifebarber Exp $
009:         */
010:
011:        package com.triactive.jdo.sco;
012:
013:        import com.triactive.jdo.SCO;
014:        import java.io.ObjectStreamException;
015:        import javax.jdo.JDOHelper;
016:
017:        /**
018:         * A mutable second-class date object.
019:         *
020:         * @author <a href="mailto:mmartin5@austin.rr.com">Mike Martin</a>
021:         * @version $Revision: 1.6 $
022:         */
023:
024:        public class Date extends java.util.Date implements  SCO {
025:            private transient Object owner;
026:            private transient String fieldName;
027:
028:            /**
029:             * Creates a <tt>Date</tt> object that represents the same time as the
030:             * given <tt>java.util.Date</tt>. Assigns owning object and field name.
031:             *
032:             * @param owner     the owning object
033:             * @param fieldName the owning field name
034:             * @param date      the initial date value
035:             */
036:
037:            public Date(Object owner, String fieldName, java.util.Date date) {
038:                super (date.getTime());
039:
040:                this .owner = owner;
041:                this .fieldName = fieldName;
042:            }
043:
044:            public Object getOwner() {
045:                return owner;
046:            }
047:
048:            public String getFieldName() {
049:                return fieldName;
050:            }
051:
052:            public void makeDirty() {
053:                if (owner != null)
054:                    JDOHelper.makeDirty(owner, fieldName);
055:            }
056:
057:            public void applyUpdates() {
058:            }
059:
060:            public void unsetOwner() {
061:                owner = null;
062:                fieldName = null;
063:            }
064:
065:            /**
066:             * Creates and returns a copy of this object.
067:             *
068:             * <p>Mutable second-class Objects are required to provide a public
069:             * clone method in order to allow for copying PersistenceCapable
070:             * objects. In contrast to Object.clone(), this method must not throw a
071:             * CloneNotSupportedException.
072:             */
073:
074:            public Object clone() {
075:                Object obj = super .clone();
076:
077:                ((Date) obj).unsetOwner();
078:
079:                return obj;
080:            }
081:
082:            public void setTime(long time) {
083:                super .setTime(time);
084:                makeDirty();
085:            }
086:
087:            /**
088:             * Sets the year of this <tt>Date</tt> object to be the specified 
089:             * value plus 1900. This <code>Date</code> object is modified so 
090:             * that it represents a point in time within the specified year, 
091:             * with the month, date, hour, minute, and second the same as 
092:             * before, as interpreted in the local time zone. (Of course, if 
093:             * the date was February 29, for example, and the year is set to a 
094:             * non-leap year, then the new date will be treated as if it were 
095:             * on March 1.)
096:             *
097:             * @param   year    the year value.
098:             * @see     java.util.Calendar
099:             * @deprecated As of JDK version 1.1,
100:             * replaced by <code>Calendar.set(Calendar.YEAR, year + 1900)</code>.
101:             */
102:
103:            public void setYear(int year) {
104:                super .setYear(year);
105:                makeDirty();
106:            }
107:
108:            /**
109:             * Sets the month of this date to the specified value. This 
110:             * <tt>Date</tt> object is modified so that it represents a point 
111:             * in time within the specified month, with the year, date, hour, 
112:             * minute, and second the same as before, as interpreted in the 
113:             * local time zone. If the date was October 31, for example, and 
114:             * the month is set to June, then the new date will be treated as 
115:             * if it were on July 1, because June has only 30 days.
116:             *
117:             * @param   month   the month value between 0-11.
118:             * @see     java.util.Calendar
119:             * @deprecated As of JDK version 1.1,
120:             * replaced by <code>Calendar.set(Calendar.MONTH, int month)</code>.
121:             */
122:
123:            public void setMonth(int month) {
124:                super .setMonth(month);
125:                makeDirty();
126:            }
127:
128:            /**
129:             * Sets the day of the month of this <tt>Date</tt> object to the 
130:             * specified value. This <tt>Date</tt> object is modified so that 
131:             * it represents a point in time within the specified day of the 
132:             * month, with the year, month, hour, minute, and second the same 
133:             * as before, as interpreted in the local time zone. If the date 
134:             * was April 30, for example, and the date is set to 31, then it 
135:             * will be treated as if it were on May 1, because April has only 
136:             * 30 days.
137:             *
138:             * @param   date   the day of the month value between 1-31.
139:             * @see     java.util.Calendar
140:             * @deprecated As of JDK version 1.1,
141:             * replaced by <code>Calendar.set(Calendar.DAY_OF_MONTH, int date)</code>.
142:             */
143:
144:            public void setDate(int date) {
145:                super .setDate(date);
146:                makeDirty();
147:            }
148:
149:            /**
150:             * Sets the hour of this <tt>Date</tt> object to the specified value. 
151:             * This <tt>Date</tt> object is modified so that it represents a point 
152:             * in time within the specified hour of the day, with the year, month, 
153:             * date, minute, and second the same as before, as interpreted in the 
154:             * local time zone.
155:             *
156:             * @param   hours   the hour value.
157:             * @see     java.util.Calendar
158:             * @deprecated As of JDK version 1.1,
159:             * replaced by <code>Calendar.set(Calendar.HOUR_OF_DAY, int hours)</code>.
160:             */
161:
162:            public void setHours(int hours) {
163:                super .setHours(hours);
164:                makeDirty();
165:            }
166:
167:            /**
168:             * Sets the minutes of this <tt>Date</tt> object to the specified value. 
169:             * This <tt>Date</tt> object is modified so that it represents a point 
170:             * in time within the specified minute of the hour, with the year, month, 
171:             * date, hour, and second the same as before, as interpreted in the 
172:             * local time zone.
173:             *
174:             * @param   minutes   the value of the minutes.
175:             * @see     java.util.Calendar
176:             * @deprecated As of JDK version 1.1,
177:             * replaced by <code>Calendar.set(Calendar.MINUTE, int minutes)</code>.
178:             */
179:
180:            public void setMinutes(int minutes) {
181:                super .setMinutes(minutes);
182:                makeDirty();
183:            }
184:
185:            /**
186:             * Sets the seconds of this <tt>Date</tt> to the specified value. 
187:             * This <tt>Date</tt> object is modified so that it represents a 
188:             * point in time within the specified second of the minute, with 
189:             * the year, month, date, hour, and minute the same as before, as 
190:             * interpreted in the local time zone.
191:             *
192:             * @param   seconds   the seconds value.
193:             * @see     java.util.Calendar
194:             * @deprecated As of JDK version 1.1,
195:             * replaced by <code>Calendar.set(Calendar.SECOND, int seconds)</code>. 
196:             */
197:
198:            public void setSeconds(int seconds) {
199:                super .setSeconds(seconds);
200:                makeDirty();
201:            }
202:
203:            /**
204:             * Replaces the object to be serialized with a java.util.Date object.
205:             * Invoked by the serialization mechanism to obtain an alternative object
206:             * to be used when writing an object to the stream.
207:             *
208:             * @return
209:             *      The <code>Date</code> to be serialized instead of this object.
210:             */
211:
212:            protected Object writeReplace() throws ObjectStreamException {
213:                return new java.util.Date(getTime());
214:            }
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.