MapperSerializationStrategy

open class MapperSerializationStrategy<I, O>(base: SerializationStrategy<I>, serialize: (O) -> I) : SerializationStrategy<O>

Use this serializer when you have serializable type I and want to map it to some O in process of serialization

Parameters

base

Serializer for I

serialize

Will be used in serialize method to convert incoming O to I and serialize with base

Constructors

Link copied to clipboard
constructor(base: SerializationStrategy<I>, serialize: (O) -> I)

Functions

Link copied to clipboard
inline fun <I : Any, O> SerializationStrategy<I>.mapSerialization(noinline serialize: (O) -> I): MapperSerializationStrategy<I, O>

Will create MapperSerializationStrategy to allow you to map O to I using serialize lambda during serialization process

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

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor