org.datanucleus.sco.simple
Class SqlTime

java.lang.Object
  extended by java.util.Date
      extended by java.sql.Time
          extended by org.datanucleus.sco.simple.SqlTime
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>, SCO

public class SqlTime
extends java.sql.Time
implements SCO

A mutable second-class SQLTime object.

See Also:
Serialized Form

Field Summary
protected  java.lang.String fieldName
           
protected  java.lang.Object owner
           
protected  StateManager ownerSM
           
 
Constructor Summary
SqlTime(StateManager ownerSM, java.lang.String fieldName)
          Creates a SqlTime 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.
 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.
 java.lang.Object getValue()
          Accessor for the unwrapped value that we are wrapping.
 void initialise()
          Method to initialise the SCO for use.
 void initialise(java.lang.Object o, boolean forInsert, boolean forUpdate)
          Method to initialise the SCO from an existing value.
 void makeDirty()
          Utility to mark the object as dirty
 void setTime(long time)
          Sets the time of this Time object to the specified value.
 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.Time
getDate, getDay, getMonth, getYear, setDate, setMonth, setYear, toString, valueOf
 
Methods inherited from class java.util.Date
after, before, compareTo, equals, getHours, getMinutes, getSeconds, getTime, getTimezoneOffset, hashCode, parse, setHours, setMinutes, setSeconds, toGMTString, toLocaleString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

owner

protected transient java.lang.Object owner

ownerSM

protected transient StateManager ownerSM

fieldName

protected transient java.lang.String fieldName
Constructor Detail

SqlTime

public SqlTime(StateManager ownerSM,
               java.lang.String fieldName)
Creates a SqlTime object that represents the time at which it was allocated.

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

initialise

public void initialise()
Method to initialise the SCO for use.

Specified by:
initialise in interface SCO

initialise

public void initialise(java.lang.Object o,
                       boolean forInsert,
                       boolean forUpdate)
Method to initialise the SCO from an existing value.

Specified by:
initialise in interface SCO
Parameters:
o - The Object
forInsert - Whether the object needs inserting in the datastore with this value
forUpdate - Whether to update the datastore with this value

getValue

public java.lang.Object getValue()
Accessor for the unwrapped value that we are wrapping.

Specified by:
getValue in interface SCO
Returns:
The unwrapped 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


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

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
Overrides:
clone in class java.util.Date
Returns:
Clone of the object

setTime

public void setTime(long time)
Sets the time of this Time object to the specified value. This Time object is modified so that it represents a point in time with the hour, minute, second as specified.

Overrides:
setTime in class java.sql.Time
Parameters:
time - millisecs since 1 Jan 1970, 00:00:00 GMT
See Also:
Calendar

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 © 2010. All Rights Reserved.