Record Class ZonedTimestampValue

java.lang.Object
java.lang.Record
com.darkcollective.relix.value.ZonedTimestampValue
Record Components:
value - the moment and its offset; must not be null
All Implemented Interfaces:
Value

public record ZonedTimestampValue(OffsetDateTime value) extends Record implements 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 Details

    • ZonedTimestampValue

      public ZonedTimestampValue(OffsetDateTime value)
      Creates an instance of a ZonedTimestampValue record class.
      Parameters:
      value - the value for the value record component
  • Method Details

    • instant

      public Instant instant()
      The instant this value names, without its offset.
      Returns:
      the instant
    • equals

      public boolean equals(Object obj)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • isNull

      public boolean isNull()
      Description copied from interface: Value
      Returns true if this value is null (absent).
      Specified by:
      isNull in interface Value
      Returns:
      whether this is a NullValue
    • type

      public ScalarType type()
      Description copied from interface: Value
      Returns the ScalarType that describes this value's kind. NullValue returns ScalarType.ANY.
      Specified by:
      type in interface Value
      Returns:
      the scalar type
    • asDisplayString

      public String asDisplayString()
      Returns the ISO-8601 local time and its offset, e.g. "2026-03-01T09:00:00+02:00", or with Z for UTC.
      Specified by:
      asDisplayString in interface Value
      Returns:
      ISO-8601 offset date-time string
    • toString

      public final 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • value

      public OffsetDateTime value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component