org.jpox.sco
Class SqlTimestamp

java.lang.Object
  extended byjava.util.Date
      extended byjava.sql.Timestamp
          extended byorg.jpox.sco.SqlTimestamp
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, SCO, java.io.Serializable

public class SqlTimestamp
extends java.sql.Timestamp
implements SCO

A mutable second-class SQL timestamp object.

Version:
$Revision: 1.17 $
See Also:
Serialized Form

Constructor Summary
SqlTimestamp(StateManager ownerSM, java.lang.String fieldName)
          Creates a SqlTimestamp object that represents the time at which it was allocated.
 
Method Summary
 void attachCopy(java.lang.Object value)
          Method to return an attached version for the passed StateManager and field, using the passed value.
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void detach(FetchPlanState state)
          Method to detach this object.
 java.lang.Object detachCopy(FetchPlanState state)
          Method to detach a copy of this object.
 java.lang.String getFieldName()
          Accessor for the field name
 java.lang.Object getOwner()
          Accessor for the owner.
 void makeDirty()
          Utility to mark the object as dirty
 void makeTransient(FetchPlanState state)
          Method to make transient this object.
 void runReachability(java.util.Set reachables)
          Method to run reachability on this SCO.
 void setDate(int date)
          Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date).
 void setHours(int hours)
          Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.HOUR_OF_DAY, int hours).
 void setMinutes(int minutes)
          Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.MINUTE, int minutes).
 void setMonth(int month)
          Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.MONTH, int month).
 void setNanos(int time_nanos)
          Mutator for the time in nanos.
 void setSeconds(int seconds)
          Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.SECOND, int seconds).
 void setTime(long time)
          Mutator for the time.
 void setValueFrom(java.lang.Object o, boolean forUpdate)
          Mutator for the value, using an object.
 void setYear(int year)
          Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.YEAR, year + 1900).
 void unsetOwner()
          Utility to unset the owner.
protected  java.lang.Object writeReplace()
          The writeReplace method is called when ObjectOutputStream is preparing to write the object to the stream.
 
Methods inherited from class java.sql.Timestamp
after, before, compareTo, compareTo, equals, equals, getNanos, getTime, toString, valueOf
 
Methods inherited from class java.util.Date
after, before, compareTo, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTimezoneOffset, getYear, hashCode, parse, toGMTString, toLocaleString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SqlTimestamp

public SqlTimestamp(StateManager ownerSM,
                    java.lang.String fieldName)
Creates a SqlTimestamp object that represents the time at which it was allocated. Assigns owning object and field name.

Parameters:
ownerSM - the owning object
fieldName - the owning field name
Method Detail

clone

public java.lang.Object clone()
Creates and returns a copy of this object.

Mutable second-class Objects are required to provide a public clone method in order to allow for copying PersistenceCapable objects. In contrast to Object.clone(), this method must not throw a CloneNotSupportedException.

Specified by:
clone in interface SCO
Returns:
A clone of the object

setTime

public void setTime(long time)
Mutator for the time.

Parameters:
time - The time (millisecs)

setNanos

public void setNanos(int time_nanos)
Mutator for the time in nanos.

Parameters:
time_nanos - The time (nanos)

setYear

public void setYear(int year)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.YEAR, year + 1900).

Sets the year of this Date object to be the specified value plus 1900. This Date object is modified so that it represents a point in time within the specified year, with the month, date, hour, minute, and second the same as before, as interpreted in the local time zone. (Of course, if the date was February 29, for example, and the year is set to a non-leap year, then the new date will be treated as if it were on March 1.)

Parameters:
year - the year value.
See Also:
Calendar

setMonth

public void setMonth(int month)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.MONTH, int month).

Sets the month of this date to the specified value. This Date object is modified so that it represents a point in time within the specified month, with the year, date, hour, minute, and second the same as before, as interpreted in the local time zone. If the date was October 31, for example, and the month is set to June, then the new date will be treated as if it were on July 1, because June has only 30 days.

Parameters:
month - the month value between 0-11.
See Also:
Calendar

setDate

public void setDate(int date)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date).

Sets the day of the month of this Date object to the specified value. This Date object is modified so that it represents a point in time within the specified day of the month, with the year, month, hour, minute, and second the same as before, as interpreted in the local time zone. If the date was April 30, for example, and the date is set to 31, then it will be treated as if it were on May 1, because April has only 30 days.

Parameters:
date - the day of the month value between 1-31.
See Also:
Calendar

setHours

public void setHours(int hours)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.HOUR_OF_DAY, int hours).

Sets the hour of this Date object to the specified value. This Date object is modified so that it represents a point in time within the specified hour of the day, with the year, month, date, minute, and second the same as before, as interpreted in the local time zone.

Parameters:
hours - the hour value.
See Also:
Calendar

setMinutes

public void setMinutes(int minutes)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.MINUTE, int minutes).

Sets the minutes of this Date object to the specified value. This Date object is modified so that it represents a point in time within the specified minute of the hour, with the year, month, date, hour, and second the same as before, as interpreted in the local time zone.

Parameters:
minutes - the value of the minutes.
See Also:
Calendar

setSeconds

public void setSeconds(int seconds)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.SECOND, int seconds).

Sets the seconds of this Date to the specified value. This Date object is modified so that it represents a point in time within the specified second of the minute, with the year, month, date, hour, and minute the same as before, as interpreted in the local time zone.

Parameters:
seconds - the seconds value.
See Also:
Calendar

setValueFrom

public void setValueFrom(java.lang.Object o,
                         boolean forUpdate)
Mutator for the value, using an object.

Specified by:
setValueFrom in interface SCO
Parameters:
o - The Object
forUpdate - Whether to update the datastore with this value

unsetOwner

public void unsetOwner()
Utility to unset the owner.

Specified by:
unsetOwner in interface SCO

getOwner

public java.lang.Object getOwner()
Accessor for the owner.

Specified by:
getOwner in interface SCO
Returns:
The owner

getFieldName

public java.lang.String getFieldName()
Accessor for the field name

Specified by:
getFieldName in interface SCO
Returns:
The field name

makeDirty

public void makeDirty()
Utility to mark the object as dirty


makeTransient

public void makeTransient(FetchPlanState state)
Method to make transient this object.

Specified by:
makeTransient in interface SCO
Parameters:
state - State for the fetchplan process

detach

public void detach(FetchPlanState state)
Method to detach this object.

Specified by:
detach in interface SCO
Parameters:
state - State for the detachment process

runReachability

public void runReachability(java.util.Set reachables)
Method to run reachability on this SCO.

Specified by:
runReachability in interface SCO
Parameters:
reachables - List of StateManagers reachable so far

detachCopy

public java.lang.Object detachCopy(FetchPlanState state)
Method to detach a copy of this object.

Specified by:
detachCopy in interface SCO
Parameters:
state - State for detachment process
Returns:
The detached object

attachCopy

public void attachCopy(java.lang.Object value)
Method to return an attached version for the passed StateManager and field, using the passed value.

Specified by:
attachCopy in interface SCO
Parameters:
value - The new value

writeReplace

protected java.lang.Object writeReplace()
                                 throws java.io.ObjectStreamException
The writeReplace method is called when ObjectOutputStream is preparing to write the object to the stream. The ObjectOutputStream checks whether the class defines the writeReplace method. If the method is defined, the writeReplace method is called to allow the object to designate its replacement in the stream. The object returned should be either of the same type as the object passed in or an object that when read and resolved will result in an object of a type that is compatible with all references to the object.

Returns:
the replaced object
Throws:
java.io.ObjectStreamException


Copyright © -2007 . All Rights Reserved.