Package com.darkcollective.relix.value
Record Class ZonedTimestampValue
java.lang.Object
java.lang.Record
com.darkcollective.relix.value.ZonedTimestampValue
- Record Components:
value- the moment and its offset; must not benull
- All Implemented Interfaces:
Value
A runtime
TIMESTAMPTZ value: a point on the timeline with the UTC offset it was
recorded at, backed by OffsetDateTime (e.g. 2026-03-01T09:00:00+02:00).
It is SQL's TIMESTAMP WITH TIME ZONE, as SQL Server's datetimeoffset
keeps it.
Two zoned timestamps are the same value when they name the same instant, as
SQL compares them: 09:00+02:00 equals 07:00Z. Each keeps the offset it
was written with, which is what it displays and what its local time is read in.
Equality and hashing read the instant, so =, δ
and γ agree.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of aZonedTimestampValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the ISO-8601 local time and its offset, e.g.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.instant()The instant this value names, without its offset.booleanisNull()Returnstrueif this value is null (absent).final StringtoString()Returns a string representation of this record class.type()Returns theScalarTypethat describes this value's kind.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
ZonedTimestampValue
Creates an instance of aZonedTimestampValuerecord class.- Parameters:
value- the value for thevaluerecord component
-
-
Method Details
-
instant
The instant this value names, without its offset.- Returns:
- the instant
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
isNull
public boolean isNull()Description copied from interface:ValueReturnstrueif this value is null (absent). -
type
Description copied from interface:Value -
asDisplayString
Returns the ISO-8601 local time and its offset, e.g."2026-03-01T09:00:00+02:00", or withZfor UTC.- Specified by:
asDisplayStringin interfaceValue- Returns:
- ISO-8601 offset date-time string
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-