com.ibm.mm.sdk.common
Class DKTime
- java.lang.Object
-
- java.util.Date
-
- java.sql.Time
-
- com.ibm.mm.sdk.common.DKTime
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>
public class DKTime extends java.sql.Time implements java.io.SerializableDKTime represents time data-types from back-end datastores in hh-mm-ss format. This class extends java.sql.Time and implements Serializable for proper time handling and persistence in the IBM Content Manager SDK.DKTime is compatible with DKDDO for sending attributes with DKTime type in and out of datastores. The default string format is hh-mm-ss.
- See Also:
Time,Date,DKDDO, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DKTime(int hour, int minute, int second)Constructs a DKTime object from the provided hour, minute, and second parameters.DKTime(long time)Constructs a DKTime object from a long integer value representing the number of milliseconds since January 1, 1970, 00:00:00 GMT (Unix epoch time).DKTime(java.sql.Time time)Constructs a DKTime from a given java.sql.Time object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringtoString()Gets the string representation of this time object.static java.sql.TimevalueOf(java.lang.String s)Constructs a DKTime object using the string value of a given time in hh.mm.ss format.-
Methods inherited from class java.sql.Time
getDate, getDay, getMonth, getYear, setDate, setMonth, setTime, setYear, toInstant, toLocalTime, valueOf
-
-
-
-
Constructor Detail
-
DKTime
public DKTime(int hour, int minute, int second)Constructs a DKTime object from the provided hour, minute, and second parameters. This constructor validates that hour is between 0 and 23 inclusive, minute is between 0 and 59 inclusive, and second is between 0 and 59 inclusive.- Parameters:
hour- hour is an integer value between 0 and 23 inclusiveminute- minute is an integer value between 0 and 59 inclusivesecond- second is an integer value between 0 and 59 inclusive- Throws:
java.lang.IllegalArgumentException- if hour is not between 0 and 23, or minute is not between 0 and 59, or second is not between 0 and 59
-
DKTime
public DKTime(long time)
Constructs a DKTime object from a long integer value representing the number of milliseconds since January 1, 1970, 00:00:00 GMT (Unix epoch time). This constructor properly initializes the DKTime object by calling the superclass constructor Time(long time) from java.sql.Time.- Parameters:
time- a long integer representing the number of milliseconds since January 1, 1970, 00:00:00 GMT
-
DKTime
public DKTime(java.sql.Time time)
Constructs a DKTime from a given java.sql.Time object. This constructor creates a new DKTime instance with the same time value as the provided java.sql.Time object.- Parameters:
time- a java.sql.Time object
-
-
Method Detail
-
valueOf
public static java.sql.Time valueOf(java.lang.String s)
Constructs a DKTime object using the string value of a given time in hh.mm.ss format. This static factory method parses the time string and creates a new DKTime instance.- Parameters:
s- time in string format (hh.mm.ss)- Returns:
- a java.sql.Time object (DKTime instance)
- Throws:
java.lang.IllegalArgumentException- if the string cannot be parsed as a valid time
-
toString
public java.lang.String toString()
Gets the string representation of this time object. The default format is hh.mm.ss, as required by the majority of datastores.- Overrides:
toStringin classjava.sql.Time- Returns:
- string representation of time in hh.mm.ss format
-
-