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 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 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.