CborSerializable
Marks class for automatic CBOR serialization code generation.
CBOR serializer uses a CBOR map that maps Kotlin field names to serialized field values.
Fields with value null
are not written to the serialized map.
The following field types are allowed:
primitive:
Int
,Long
,Float
,Double
,String
,Boolean
time:
Instant
andLocalDate
binary:
ByteString
andByteArray
CBOR generic value:
DataItem
enums
types manually implementing CBOR serialization (annotated by CborSerializationImplemented)
types with automatically generated CBOR serialization (annotated by CborSerializable)
maps, lists, or sets of the above (sets are treated as lists)
nullable variants of the above
Single-level sealed class hierarchies are supported. Annotation is required only on the root class of the sealed hierarchy. A special key ("type" by default, see typeKey) is added to CBOR map to indicate the actual value type (type id). It is recommended that leaf class names include base class name either as a prefix or a suffix. Type id is generated from the leaf class name, stripping base class name if possible or can be specified explicitly by typeId.