envzn
0.8 · beta · not released

Library / Misc / Serialisation / Fields

CLASS

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_PATTERN

The wire form of a `DateTime` cell.

String CONSTANT_MODIFIER

The modifier prefix of a CONSTANT field, which never travels.

Methods 22

METHOD travels(REFERENCE IdentityField field) RETURNS boolean
reads

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 STATUS
reads

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 STATUS
reads

A key the type does not have: skipped in LENIENT, refused in STRICT.

METHOD mark(int64 seen, int32 wire) RETURNS int64
reads

seen with wire field wire marked; a negative index marks nothing.

METHOD complete(int64 seen, REFERENCE Identity type, ParseMode mode) RETURNS STATUS
reads

STRICT: FAILURE naming the first travelling field whose slot seen never marked. LENIENT: SUCCESS.

METHOD mismatch(REFERENCE String typeName, REFERENCE String fieldName) RETURNS STATUS
reads

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 String
reads

": missing field ". Error texts here are built by appends, not format: in a template $1: reads as a format spec and eats the colon.

METHOD labelled(REFERENCE String head, REFERENCE String message) RETURNS String
reads

": " — the same append-built form, for every Fields error.

METHOD markWide(MUTABLE REFERENCE int64[] seen, int32 wire) RETURNS void
reads

Mark wire field wire in seen[wire / 64], growing seen to fit.

METHOD completeWide(REFERENCE int64[] seen, REFERENCE Identity type, ParseMode mode) RETURNS STATUS
reads

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 STATUS
reads

An enum case as the pair {"name": <case name>, "value": <backing integer>}.

METHOD readEnum(MUTABLE REFERENCE Reconstructor source, REFERENCE Identity enumType) RETURNS | int32
reads

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 STATUS
reads

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 | String
reads

readEnum, answering the resolved case's NAME.

METHOD putDuration(MUTABLE REFERENCE Serializer s, REFERENCE TimeDuration d) RETURNS STATUS
reads

A TimeDuration as its ISO-8601 text (PT1H30M).

METHOD readDuration(MUTABLE REFERENCE Reconstructor source) RETURNS | TimeDuration
reads

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 STATUS
reads
METHOD readComplex(MUTABLE REFERENCE Reconstructor source) RETURNS | complex
reads

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 STATUS
reads

A ByteBuffer as a base64 string.

METHOD readBytes(MUTABLE REFERENCE Reconstructor source) RETURNS | ByteBuffer
reads

A base64 string back to a ByteBuffer; malformed base64 is a FAILURE.

METHOD putDateTime(MUTABLE REFERENCE Serializer s, REFERENCE DateTime d) RETURNS STATUS
reads

A DateTime as text in DATE_TIME_PATTERN.

METHOD readDateTime(MUTABLE REFERENCE Reconstructor source) RETURNS | DateTime
reads

Text in DATE_TIME_PATTERN back to a DateTime; text that does not parse is a FAILURE.