polymorphicDefaultDeserializer

open override fun <Base : Any> polymorphicDefaultDeserializer(baseClass: KClass<Base>, defaultDeserializerProvider: (className: String?) -> DeserializationStrategy<Base>?)(source)

Adds a default deserializers provider associated with the given baseClass to the resulting module. defaultDeserializerProvider is invoked when no polymorphic serializers associated with the className in the scope of baseClass were found. className could be null for formats that support nullable class discriminators (currently only Json with useArrayPolymorphism set to false).

Default deserializers provider affects only deserialization process. To affect serialization process, use SerializersModuleBuilder.polymorphicDefaultSerializer.

defaultDeserializerProvider can be stateful and lookup a serializer for the missing type dynamically.

See also