- java.lang.Object
-
- java.util.Date
-
- java.sql.Time
-
- org.tentackle.common.Time
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<Date>,Freezable
public class Time extends Time implements Freezable
Time with database semantics.Differs from
java.sql.Timewhen serialized/deserialized in different timezones. Databases don't provide a date and no timezone for a time, i.e. when sent over wire to different locations a time should always remain the same for all timezones. Injava.sql.Time, however, the epochal time is serialized which may lead to a different time when deserialized in another timezone. InTimethe effective date is serialized as HHMMSSmmm to provide the same semantics as databases do.Furthermore, tentackle times can be frozen, i.e. made immutable.
- Author:
- harald
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Timeclone()static TimecreateFrozen(long epoch)Creates a frozen time.voidfreeze()Makes this object immutable.voidsetDate(int date)Deprecated.voidsetHours(int hours)Deprecated.voidsetMinutes(int minutes)Deprecated.voidsetMonth(int month)Deprecated.voidsetSeconds(int seconds)Deprecated.voidsetTime(long time)voidsetYear(int year)Deprecated.-
Methods inherited from class java.sql.Time
getDate, getDay, getMonth, getYear, toInstant, toLocalTime, toString, valueOf, valueOf
-
Methods inherited from class java.util.Date
after, before, compareTo, equals, from, getHours, getMinutes, getSeconds, getTime, getTimezoneOffset, hashCode, parse, toGMTString, toLocaleString, UTC
-
-
-
-
Method Detail
-
createFrozen
public static Time createFrozen(long epoch)
Creates a frozen time.- Parameters:
epoch- epochal milliseconds since January 1, 1970, 00:00:00 GMT- Returns:
- the frozen time
-
freeze
public void freeze()
Description copied from interface:FreezableMakes this object immutable.
-
setTime
public void setTime(long time)
Overridden to clear the lazy calendar and check for frozen.
-
setYear
@Deprecated public void setYear(int year)
Deprecated.
-
setMonth
@Deprecated public void setMonth(int month)
Deprecated.
-
setDate
@Deprecated public void setDate(int date)
Deprecated.
-
setHours
@Deprecated public void setHours(int hours)
Deprecated.
-
setMinutes
@Deprecated public void setMinutes(int minutes)
Deprecated.- Overrides:
setMinutesin classDate
-
setSeconds
@Deprecated public void setSeconds(int seconds)
Deprecated.- Overrides:
setSecondsin classDate
-
-