Package dev.omnist.document
Record Class DateTimeValue
java.lang.Object
java.lang.Record
dev.omnist.document.DateTimeValue
- Record Components:
dateTime- the local date and time (required)offset- the UTC zone offset, or null if un-offset
Represents a date and time of day, joined, with optional UTC offset (omnist-spec ยง2.2.1).
-
Constructor Summary
ConstructorsConstructorDescriptionDateTimeValue(LocalDateTime dateTime, ZoneOffset offset) Creates an instance of aDateTimeValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptiondateTime()Returns the value of thedateTimerecord component.final booleanIndicates whether some other object is "equal to" this one.format()Formats this value as an ISO-8601 string suitable for OML and codec serialization.final inthashCode()Returns a hash code value for this object.static DateTimeValueof(LocalDateTime dateTime) Creates an un-offset date-time (local date-time with no UTC offset).static DateTimeValueof(LocalDateTime dateTime, ZoneOffset offset) Creates an offset date-time with an explicit UTC offset.offset()Returns the value of theoffsetrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
of
Creates an un-offset date-time (local date-time with no UTC offset).- Parameters:
dateTime- the local date and time; must not benull- Returns:
- a new
DateTimeValuewithoffset == null
-
of
Creates an offset date-time with an explicit UTC offset.- Parameters:
dateTime- the local date and time; must not benulloffset- the UTC zone offset (e.g.ZoneOffset.UTC); may benullto produce an un-offset value- Returns:
- a new
DateTimeValue
-
format
Formats this value as an ISO-8601 string suitable for OML and codec serialization. The format isYYYY-MM-DDTHH:MM:SS[.fractional]optionally followed byZfor UTC or a numeric offset such as+05:30. Un-offset values omit the trailing timezone designator entirely.- Returns:
- the ISO-8601 formatted string; never
null
-
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. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
dateTime
Returns the value of thedateTimerecord component.- Returns:
- the value of the
dateTimerecord component
-
offset
Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-