Library / Misc / Serialisation / Fields
Fields
The kernel helpers that hold the serde rules (serde-explicit-codecs design §4.2-§4.4),
so a type's serialize / reconstruct is one line per field per direction and the
rules live here, not in every codec.
Fields 4
int32 END_OF_OBJECT`nextField` after the object's last member: the object is closed.
int32 UNKNOWN_FIELD`nextField` on a key the type has no reconstructable field for.
String DATE_TIME_PATTERNThe wire form of a `DateTime` cell.
String CONSTANT_MODIFIERThe modifier prefix of a CONSTANT field, which never travels.
Methods 22
METHOD travels(REFERENCE IdentityField field) RETURNS booleanreads
Does field travel on the wire? Neither DERIVED nor CONSTANT. Asked only by the
STRICT completeness check: a reader matches the keys the stream holds and never asks.
METHOD putKey(MUTABLE REFERENCE Serializer s, REFERENCE Identity type, int32 slot) RETURNS STATUSreads
Send the key of the field in type.dataFields[slot]. Which fields travel is the
writer's decision, made where the codec is written: the helper only names the key.
METHOD unknown(MUTABLE REFERENCE Reconstructor source, ParseMode mode) RETURNS STATUSreads
A key the type does not have: skipped in LENIENT, refused in STRICT.
METHOD mark(int64 seen, int32 wire) RETURNS int64reads
seen with wire field wire marked; a negative index marks nothing.
METHOD complete(int64 seen, REFERENCE Identity type, ParseMode mode) RETURNS STATUSreads
STRICT: FAILURE naming the first travelling field whose slot seen never marked.
LENIENT: SUCCESS.
METHOD mismatch(REFERENCE String typeName, REFERENCE String fieldName) RETURNS STATUSreads
The text of a value of the wrong shape for its field (a FAILURE in every mode).
METHOD missingText(REFERENCE String typeName, REFERENCE String fieldName) RETURNS Stringreads
"format: in a template $1: reads as a format spec and eats the colon.
METHOD labelled(REFERENCE String head, REFERENCE String message) RETURNS Stringreads
"
:METHOD markWide(MUTABLE REFERENCE int64[] seen, int32 wire) RETURNS voidreads
Mark wire field wire in seen[wire / 64], growing seen to fit.
METHOD completeWide(REFERENCE int64[] seen, REFERENCE Identity type, ParseMode mode) RETURNS STATUSreads
complete over a wide seen-set: a word past the end of seen marks nothing.
METHOD putEnum(MUTABLE REFERENCE Serializer s, REFERENCE Identity enumType, int32 value) RETURNS STATUSreads
An enum case as the pair {"name": <case name>, "value": <backing integer>}.
METHOD readEnum(MUTABLE REFERENCE Reconstructor source, REFERENCE Identity enumType) RETURNS | int32reads
The pair back, keys in any order: the name resolves first, else the value;
neither matching, a half of the wrong shape, or any other key is a FAILURE.
The pair is pulled against IDENTITY(EnumKind), whose two fields are exactly
name (wire 0) and value (wire 1).
METHOD putEnumName(MUTABLE REFERENCE Serializer s, REFERENCE Identity enumType, REFERENCE String caseName) RETURNS STATUSreads
An enum case by NAME, as the pair putEnum writes. Generated AUTO code names
the case it holds; the value comes from IDENTITY(E).cases.
METHOD readEnumName(MUTABLE REFERENCE Reconstructor source, REFERENCE Identity enumType) RETURNS | Stringreads
readEnum, answering the resolved case's NAME.
METHOD putDuration(MUTABLE REFERENCE Serializer s, REFERENCE TimeDuration d) RETURNS STATUSreads
A TimeDuration as its ISO-8601 text (PT1H30M).
METHOD readDuration(MUTABLE REFERENCE Reconstructor source) RETURNS | TimeDurationreads
ISO-8601 duration text back to a TimeDuration; text that does not parse is a FAILURE.
METHOD putComplex(MUTABLE REFERENCE Serializer s, complex z) RETURNS STATUSreads
METHOD readComplex(MUTABLE REFERENCE Reconstructor source) RETURNS | complexreads
The pair back, keys in any order; a missing half is 0, any other key a FAILURE.
METHOD putBytes(MUTABLE REFERENCE Serializer s, REFERENCE ByteBuffer b) RETURNS STATUSreads
A ByteBuffer as a base64 string.
METHOD readBytes(MUTABLE REFERENCE Reconstructor source) RETURNS | ByteBufferreads
A base64 string back to a ByteBuffer; malformed base64 is a FAILURE.
METHOD putDateTime(MUTABLE REFERENCE Serializer s, REFERENCE DateTime d) RETURNS STATUSreads
A DateTime as text in DATE_TIME_PATTERN.
METHOD readDateTime(MUTABLE REFERENCE Reconstructor source) RETURNS | DateTimereads
Text in DATE_TIME_PATTERN back to a DateTime; text that does not parse is a FAILURE.