public class Time extends Time implements Freezable
Differs from java.sql.Time when
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. In
java.sql.Time, however, the epochal time is serialized which may lead
to a different time when deserialized in another timezone. In Time
the effective date is serialized as HHMMSSmmm to provide the same semantics
as databases do.
Furthermore, tentackle times can be frozen, i.e. made immutable.
| Constructor and Description |
|---|
Time()
Creates the current time.
|
Time(long time)
Constructs a
Time object using a milliseconds time value. |
| Modifier and Type | Method and Description |
|---|---|
Time |
clone() |
static Time |
createFrozen(long epoch)
Creates a frozen time.
|
void |
freeze()
Makes this object immutable.
|
Calendar |
getCalendar()
Gets the calendar for this date.
|
void |
setDate(int date) |
void |
setHours(int hours) |
void |
setMinutes(int minutes) |
void |
setMonth(int month) |
void |
setSeconds(int seconds) |
void |
setTime(long time) |
void |
setYear(int year) |
getDate, getDay, getMonth, getYear, toInstant, toLocalTime, toString, valueOf, valueOfafter, before, compareTo, equals, from, getHours, getMinutes, getSeconds, getTime, getTimezoneOffset, hashCode, parse, toGMTString, toLocaleString, UTCpublic Time(long time)
Time object using a milliseconds time value.time - milliseconds since January 1, 1970, 00:00:00 GMT; a negative
number is milliseconds before January 1, 1970, 00:00:00 GMTpublic Time()
public static Time createFrozen(long epoch)
epoch - epochal milliseconds since January 1, 1970, 00:00:00 GMTpublic Calendar getCalendar()
public void freeze()
Freezablepublic void setTime(long time)
Overridden to clear the lazy calendar and check for frozen.
public void setMinutes(int minutes)
setMinutes in class Datepublic void setSeconds(int seconds)
setSeconds in class DateTentackle - distributed, domain- and model-driven