WowJson

object WowJson

The one JSON mapper configuration of Wow: the kernel's event codec, the cluster codec and every backend build their mappers from builder, so a value means the same thing wherever it is read.

  • It registers a fixed set of modules, the Kotlin module and Wow's own, and never discovers others on the class path: what Wow stores and sends must not depend on what a host happens to bring.

  • Wow's own enumerations are written by their lower-kebab wire names, and read by them alone (WowEnums); a domain's enumerations are written as its Jackson writes them. A java.time.Month is written by its name, as every enumeration is (MonthNames). A number for an enumeration is refused (StrictReads), where Jackson would read it, or its text, as the constant of that index.

  • A kotlin.time.Duration is ISO-8601 text, as a java.time.Duration is (KotlinDurations).

  • An OffsetDateTime or a ZonedDateTime is read back at the offset it was written with, as a java.time value prints it: 2026-01-02T03:04:05+08:00 reads as +08:00, not as the same instant at UTC, which is Jackson's default. So a state that holds the offset of its event is the state its log rebuilds. A ZonedDateTime is written with its offset, not its region's name, and reads back in that fixed offset.

  • A read refuses what Wow never writes and Jackson would coerce or read loosely (StrictReads): a float or a string for an integer, a number for a boolean or a String, a string for a number, a time on a LocalDate. The numbers and arrays its JSON wrote for dates and times before 9.0 still read.

  • A me.ahoo.wow.spi.log.Transport is written in its one form (TransportCodec), wherever a message embeds one.

  • JSON numbers keep their exact value. A decimal read into an untyped value (Any, Map<String, Any?>) or a tree is a java.math.BigDecimal with all its digits and its scale, never a Double, so 2.50 stays 2.50; trees keep trailing zeros. An integer is an Int, a Long or, beyond Long, a java.math.BigInteger, whichever holds it, which is exact already. Typed properties (Double, BigDecimal, ...) are read as their type says.

  • An AggregateRef is written as {type: {context, name}, tenantId, id}, its derived AggregateRef.isAssigned left out, and an id not chosen yet (AggregateRef.UNASSIGNED) written null: (none) is never an id on the wire, and a ref that names it is refused when read. A ref whose id is null or left out reads as not assigned.

  • A read ignores the properties it does not know, at every level, as Jackson 3 does by default; stated here so that the cluster codec's lenient reading and the event codec's reading of older payloads do not rest on a library default. A request's body is read stricter (JsonReadFailures.requestReader): a property given twice is refused, and a command's body refuses a property its command does not have.

  • A property with no setter that the class holds in a field, a val of its body, is read into that field, as 9.x's JSON read it: a collection or map it fills as it goes (val items = sortedSetOf<String>(), a MutableList or MutableMap val) reads back filled, and a value set at construction (val label = "") reads back as written. Jackson 3 would leave either as the class built it. A computed property, a getter with no field behind it, is written and not read.

Properties

Link copied to clipboard
val mapper: JsonMapper

The mapper of Wow's configuration, as builder makes it.

Functions

Link copied to clipboard
fun builder(): JsonMapper.Builder

A new builder with Wow's configuration, for a reader or writer that adds settings of its own.

Link copied to clipboard
fun readerBuilder(): JsonMapper.Builder

A new builder of a reader that may be older than the writer of what it reads, Wow's builder reading an unknown value of a result's status, a hop's stage or a function's kind as UNKNOWN (WowEnums): the client of a peer that was upgraded first, or a node of the minor version before its cluster's. A reader of requests keeps refusing an unknown value: it is newer than its client, and taking a typo for a value would change its meaning.