- java.lang.Object
-
- java.util.Date
-
- java.sql.Time
-
- org.datanucleus.store.types.wrappers.SqlTime
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Date>
,SCO<Time>
public class SqlTime extends Time implements SCO<Time>
A mutable second-class SQLTime object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractMemberMetaData
ownerMmd
protected DNStateManager
ownerSM
-
Constructor Summary
Constructors Constructor Description SqlTime(DNStateManager sm, AbstractMemberMetaData mmd)
Creates a SqlTime object that represents the time at which it was allocated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attachCopy(Time value)
Method to return an attached version for the passed StateManager and field, using the passed value.Object
clone()
Creates and returns a copy of this object.Time
detachCopy(FetchPlanState state)
Method to detach a copy of this object.String
getFieldName()
Accessor for the field nameObject
getOwner()
Accessor for the owner.Time
getValue()
Accessor for the unwrapped value that we are wrapping.void
initialise()
Method to initialise the SCO for use, and allowing the SCO to be loaded from the datastore (when we have a backing store).void
initialise(Time t)
Method to initialise the SCO for use with the provided initial value.void
initialise(Time newValue, Object oldValue)
Method to initialise the SCO for use, where replacing an old value with a new value such as when calling a setter field passing in a new value.void
makeDirty()
Utility to mark the object as dirtyvoid
setTime(long time)
Sets the time of this Time object to the specified value.void
unsetOwner()
Utility to unset the owner.protected 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, toInstant, toLocalTime, toString, valueOf, valueOf
-
Methods inherited from class java.util.Date
after, before, compareTo, equals, from, getHours, getMinutes, getSeconds, getTime, getTimezoneOffset, hashCode, parse, setHours, setMinutes, setSeconds, toGMTString, toLocaleString, UTC
-
-
-
-
Field Detail
-
ownerSM
protected transient DNStateManager ownerSM
-
ownerMmd
protected transient AbstractMemberMetaData ownerMmd
-
-
Constructor Detail
-
SqlTime
public SqlTime(DNStateManager sm, AbstractMemberMetaData mmd)
Creates a SqlTime object that represents the time at which it was allocated.- Parameters:
sm
- StateManager for the owning objectmmd
- Metadata for the member
-
-
Method Detail
-
initialise
public void initialise()
Description copied from interface:SCO
Method to initialise the SCO for use, and allowing the SCO to be loaded from the datastore (when we have a backing store). This can be utilised to perform any eager loading of information from the datastore.- Specified by:
initialise
in interfaceSCO<Time>
-
initialise
public void initialise(Time newValue, Object oldValue)
Description copied from interface:SCO
Method to initialise the SCO for use, where replacing an old value with a new value such as when calling a setter field passing in a new value. Note that oldValue is marked as Object since for cases where the member type is Collection the newValue could be, for example, ArrayList, and the oldValue of type Collection (representing null).- Specified by:
initialise
in interfaceSCO<Time>
- Parameters:
newValue
- New value (to wrap)oldValue
- Old value (to use in deciding what needs deleting etc)
-
initialise
public void initialise(Time t)
Description copied from interface:SCO
Method to initialise the SCO for use with the provided initial value. This is used, for example, when retrieving the field from the datastore and setting it in the persistable object.- Specified by:
initialise
in interfaceSCO<Time>
- Parameters:
t
- the object from which to copy the value.
-
getValue
public Time getValue()
Accessor for the unwrapped value that we are wrapping.
-
unsetOwner
public void unsetOwner()
Utility to unset the owner.- Specified by:
unsetOwner
in interfaceSCO<Time>
-
getOwner
public Object getOwner()
Accessor for the owner.
-
getFieldName
public String getFieldName()
Accessor for the field name- Specified by:
getFieldName
in interfaceSCO<Time>
- Returns:
- The field name
-
makeDirty
public void makeDirty()
Utility to mark the object as dirty
-
detachCopy
public Time detachCopy(FetchPlanState state)
Method to detach a copy of this object.- Specified by:
detachCopy
in interfaceSCO<Time>
- Parameters:
state
- State for detachment process- Returns:
- The detached object
-
attachCopy
public void attachCopy(Time value)
Method to return an attached version for the passed StateManager and field, using the passed value.- Specified by:
attachCopy
in interfaceSCO<Time>
- Parameters:
value
- The new value
-
clone
public 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 persistable objects. In contrast to Object.clone(), this method must not throw a CloneNotSupportedException.
-
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.
-
writeReplace
protected Object writeReplace() throws 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:
ObjectStreamException
- if an error occurs
-
-