CallbackCustomizableDeserializationStrategy

open class CallbackCustomizableDeserializationStrategy<T>(val descriptor: SerialDescriptor, defaultDeserializeCallback: (decoder: Decoder, jsonElement: JsonElement?) -> T, fallbackDeserialization: (initialException: Throwable, decoder: Decoder, jsonElement: JsonElement?) -> T = { initialException, _, _ -> throw initialException }) : CustomizableDeserializationStrategy<T>

Inheritors

Constructors

constructor(descriptor: SerialDescriptor, defaultDeserializeCallback: (decoder: Decoder, jsonElement: JsonElement?) -> T, fallbackDeserialization: (initialException: Throwable, decoder: Decoder, jsonElement: JsonElement?) -> T = { initialException, _, _ -> throw initialException })

Properties

Link copied to clipboard

Contains JsonDeserializerStrategy 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 deserialize(decoder: Decoder): T

Trying to get JsonElement if decoder is JsonDecoder. Then it will use defaultDeserializeCallback to deserialize data. In case if defaultDeserializeCallback will throw exception it will firstly try to deserialize data by strategies from customDeserializationStrategies and, if no one will return presented data in Optional it will use fallbackDeserialization as last option to deserialize data