Module com.darkcollective.relix.ast
Class TemporalLiterals
java.lang.Object
com.darkcollective.relix.ast.internal.TemporalLiterals
Parses the ISO-8601 payloads of the typed temporal literals
(
DATE '…', TIME '…', TIMESTAMP '…',
DURATION '…') into the java.time values carried by
DateOperand, TimeOperand, TimestampOperand, and
DurationOperand.
This is the single source of truth for literal payload validation, so the
parser (which reports a positioned error on a malformed payload) and the
test fixtures share identical parsing — most importantly the TIMESTAMP
UTC-normalisation rule: a payload carrying an offset
(Z, +01:00) is normalised to a UTC Instant, and a
payload without an offset is interpreted as UTC.
Every method throws DateTimeParseException (the unchecked
java.time parse failure) when the payload is not a valid ISO-8601
string of the expected shape; callers translate it into their own diagnostic.
-
Method Summary
Modifier and TypeMethodDescriptionstatic LocalDateParses an ISO-8601 local-date payload, e.g.static DurationparseDuration(String iso) Parses an ISO-8601 duration payload, e.g.static LocalTimeParses an ISO-8601 local-time payload, e.g.static InstantparseTimestamp(String iso) Parses an ISO-8601 timestamp payload into a UTCInstant.
-
Method Details
-
parseDate
Parses an ISO-8601 local-date payload, e.g."2026-06-15". -
parseTime
Parses an ISO-8601 local-time payload, e.g."13:40:00". -
parseTimestamp
Parses an ISO-8601 timestamp payload into a UTCInstant. A payload carrying an offset ("2026-06-15T13:40:00Z","…+01:00") is normalised to UTC; a payload without an offset ("2026-06-15T13:40:00") is interpreted as UTC. -
parseDuration
Parses an ISO-8601 duration payload, e.g."PT30M".
-