SerializersModuleCollector

interface SerializersModuleCollector

SerializersModuleCollector can introspect and accumulate content of any SerializersModule via SerializersModule.dumpTo, using a visitor-like pattern: contextual and polymorphic functions are invoked for each registered serializer.

Not stable for inheritance

SerializersModuleCollector interface is not stable for inheritance in 3rd party libraries, as new methods might be added to this interface or contracts of the existing methods can be changed.

Functions

Link copied to clipboard
abstract fun <T : Any> contextual(kClass: KClass<T>, provider: (typeArgumentsSerializers: List<KSerializer<*>>) -> KSerializer<*>)

Accept a provider, associated with generic kClass for contextual serialization.

open fun <T : Any> contextual(kClass: KClass<T>, serializer: KSerializer<T>)

Accept a serializer, associated with kClass for contextual serialization.

Link copied to clipboard
abstract fun <Base : Any, Sub : Base> polymorphic(    baseClass: KClass<Base>,     actualClass: KClass<Sub>,     actualSerializer: KSerializer<Sub>)

Accept a serializer, associated with actualClass for polymorphic serialization.

Link copied to clipboard
open fun <Base : Any> polymorphicDefault(baseClass: KClass<Base>, defaultDeserializerProvider: (className: String?) -> DeserializationStrategy<out Base>?)

Accept a default deserializer provider, associated with the baseClass for polymorphic deserialization.

Link copied to clipboard
abstract fun <Base : Any> polymorphicDefaultDeserializer(baseClass: KClass<Base>, defaultDeserializerProvider: (className: String?) -> DeserializationStrategy<out Base>?)

Accept a default deserializer provider, associated with the baseClass for polymorphic deserialization.

Link copied to clipboard
abstract fun <Base : Any> polymorphicDefaultSerializer(baseClass: KClass<Base>, defaultSerializerProvider: (value: Base) -> SerializationStrategy<Base>?)

Accept a default serializer provider, associated with the baseClass for polymorphic serialization.

Inheritors

Link copied to clipboard