Package org.postgresql.util
Class PGTime
- java.lang.Object
-
- java.util.Date
-
- java.sql.Time
-
- org.postgresql.util.PGTime
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<java.util.Date>
public class PGTime extends java.sql.TimeThis class augments the Java built-in Time to allow for explicit setting of the time zone.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.CalendarcalendarThe optional calendar for this time.private static longserialVersionUIDThe serial version UID.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()booleanequals(java.lang.Object o)java.util.CalendargetCalendar()Returns the calendar object for this time.inthashCode()voidsetCalendar(java.util.Calendar calendar)Sets the calendar object for this time.-
Methods inherited from class java.sql.Time
getDate, getDay, getMonth, getYear, setDate, setMonth, setTime, setYear, toInstant, toLocalTime, toString, valueOf, valueOf
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
The serial version UID.- See Also:
- Constant Field Values
-
calendar
private java.util.Calendar calendar
The optional calendar for this time.
-
-
Constructor Detail
-
PGTime
public PGTime(long time)
Constructs aPGTimewithout a time zone.- Parameters:
time- milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT.- See Also:
Time(long)
-
PGTime
public PGTime(long time, java.util.Calendar calendar)Constructs aPGTimewith the given calendar object. The calendar object is optional. If absent, the driver will treat the time astime without time zone. When present, the driver will treat the time as atime with time zoneusing theTimeZonein the calendar object. Furthermore, this calendar will be used instead of the calendar object passed toPreparedStatement.setTime(int, Time, Calendar).- Parameters:
time- milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT.calendar- the calendar object containing the time zone ornull.- See Also:
Time(long)
-
-
Method Detail
-
setCalendar
public void setCalendar(java.util.Calendar calendar)
Sets the calendar object for this time.- Parameters:
calendar- the calendar object ornull.
-
getCalendar
public java.util.Calendar getCalendar()
Returns the calendar object for this time.- Returns:
- the calendar or
null.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.util.Date
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.util.Date
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.util.Date
-
-