Asn1OpenPolymorphicWithDefaultSerializer

open class Asn1OpenPolymorphicWithDefaultSerializer<T : Any>(val baseClass: KClass<T>, val defaultSerializer: KSerializer<T>) : KSerializer<T> (source)

Uses a contextual ASN.1 open-polymorphic serializer for baseClass when one is registered in the active DER instance, and defaultSerializer otherwise.

This is useful for extensible ASN.1 types that also have a structural fallback representation. Subclass it with an object usable from @Serializable(with = ...). It keeps an open-polymorphic descriptor, so callers can add semantic subtype mappings through the usual polymorphicByTag or polymorphicByOid DSL.

Constructors

Link copied to clipboard
constructor(baseClass: KClass<T>, defaultSerializer: KSerializer<T>)

Properties

Link copied to clipboard
Link copied to clipboard
val defaultSerializer: KSerializer<T>
Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): T
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: T)