CallbackCustomizableSerializationStrategy

open class CallbackCustomizableSerializationStrategy<T>(val descriptor: SerialDescriptor, defaultSerializeCallback: (encoder: Encoder, value: T) -> Unit, fallbackSerialization: (initialException: Throwable, encoder: Encoder, value: T) -> T = { initialException, _, _ -> throw initialException }) : CustomizableSerializationStrategy<T>

Parameters

defaultSerializeCallback

Default way of serialization

fallbackSerialization

Fallback way which will be used in case when defaultSerializeCallback and customSerializationStrategies were unable to serialize data

Constructors

constructor(descriptor: SerialDescriptor, defaultSerializeCallback: (encoder: Encoder, value: T) -> Unit, fallbackSerialization: (initialException: Throwable, encoder: Encoder, value: T) -> T = { initialException, _, _ -> throw initialException })

Properties

Link copied to clipboard

Contains JsonSerializerStrategy which will be used in deserialize method when standard RawUpdate serializer will be unable to create RawUpdate (and Update as well)

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

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

Trying to serialize data by defaultSerializeCallback. If defaultSerializeCallback it will try to use each strategy from customSerializationStrategies until one of them will return true (means, serialized). If there are no any strategy success serialization and defaultSerializeCallback thrown exception will be used fallbackSerialization callback