MapperSerializationStrategy

open class MapperSerializationStrategy<I, O>(base: SerializationStrategy<I>, internalSerialize: (Encoder, O) -> I) : SerializationStrategy<O> (source)

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

internalSerialize

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

Constructors

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

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

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)