ProtoBufSumTypeSerializer

@ExperimentalSerializationApi
interface ProtoBufSumTypeSerializer<Supertype> : KSerializer<Supertype> (source)

A ProtoBuf KSerializer for sum types, aka, open/abstract/sealed classes and interfaces.

It's achieved by converting the object to a wrapper surrogate object SumTypeSupertypeSurrogate, in which the type is stored as a classifying Int number SumTypeSupertypeSurrogate.subtypeNumber.

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): Supertype
Link copied to clipboard
abstract fun getSubtypeDeserializationStrategy(subtypeNumber: Int): DeserializationStrategy<*>
abstract fun getSubtypeNumberAndSubtypeSerializationStrategy(value: Supertype): Pair<Int, SerializationStrategy<*>>
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: Supertype)