Zyle Moore
04/01/2025, 12:19 AM@SerialInfo
annotation that indicates that the property is tagged with the given name, @Field("HEDR")
. When a property has this annotation, it is encoded as a Type-Length-Value structure. As an example,
@Field("HEDR")
val header: String = "asdf"
Results in bytes matching
TT TT TT TT LL LL VV VV VV VV
(HEDR 04 00 asdf
)
But, to get this to happen, I have to override the decode*Element
method for each primitive, to support each serializable type. Example,
@Field("HEDR")
val header: String = "asdf"
@Field("INTV")
val taggedValues: Int = 1
Is there an easy/cheap way to perform this tagging on any type, without overriding that specific type in the codec?Zyle Moore
04/01/2025, 12:30 AM@Field("HEDR")
val header: Field<String>
Or inline classes, allowing me to override the inline or structure methods.