sealed class SerialModule
SerialModule is a collection of serializers used by ContextSerializer and PolymorphicSerializer to override or provide serializers at the runtime, whereas at the compile-time they provided by the serialization plugin. It can be considered as a map where serializers can be found using their statically known KClasses.
To enable runtime serializers resolution, one of the special annotations must be used on target types (Polymorphic or ContextualSerialization), and a serial module with serializers should be used during construction of SerialFormat.
See Also
(common, js, jvm, native)
dumpTo |
Copies contents of this module to the given collector. abstract fun dumpTo(collector: SerialModuleCollector): Unit |
(common, js, jvm, native)
getContextual |
Returns a contextual serializer associated with a given kclass. This method is used in context-sensitive operations on a property marked with ContextualSerialization by a ContextSerializer abstract fun <T : Any> getContextual(kclass: KClass<T>): KSerializer<T>? |
(common, js, jvm, native)
getPolymorphic |
Returns a polymorphic serializer registered for a class of the given value in the scope of baseClass. abstract fun <T : Any> getPolymorphic(baseClass: KClass<in T>, value: T): SerializationStrategy<T>?
Returns a polymorphic deserializer registered for a serializedClassName in the scope of baseClass or default value constructed from serializedClassName if default serializer provider was registered. abstract fun <T : Any> getPolymorphic(baseClass: KClass<in T>, serializedClassName: String): DeserializationStrategy<out T>? |
(common, js, jvm, native)
EmptyModule |
A SerialModule which is empty and always returns object EmptyModule : SerialModule |