Skip to content
Permalink
Browse files

Add default serializers to KotlinxSerializer

  • Loading branch information...
sommd authored and e5l committed Oct 16, 2018
1 parent 224e00b commit 648894c6d5cc5deb79e929272a49fcd0f4b45ddf
@@ -6,11 +6,24 @@ import io.ktor.client.response.*
import io.ktor.http.*
import io.ktor.http.content.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.*
import kotlinx.serialization.json.*
import kotlin.reflect.*

class KotlinxSerializer : JsonSerializer {
private val mappers = mutableMapOf<KClass<Any>, KSerializer<Any>>()
@Suppress("UNCHECKED_CAST")
private val mappers = mutableMapOf(
Unit::class as KClass<Any> to UnitSerializer as KSerializer<Any>,
Boolean::class as KClass<Any> to BooleanSerializer as KSerializer<Any>,
Byte::class as KClass<Any> to ByteSerializer as KSerializer<Any>,
Short::class as KClass<Any> to ShortSerializer as KSerializer<Any>,
Int::class as KClass<Any> to IntSerializer as KSerializer<Any>,
Long::class as KClass<Any> to LongSerializer as KSerializer<Any>,
Float::class as KClass<Any> to FloatSerializer as KSerializer<Any>,
Double::class as KClass<Any> to DoubleSerializer as KSerializer<Any>,
Char::class as KClass<Any> to CharSerializer as KSerializer<Any>,
String::class as KClass<Any> to StringSerializer as KSerializer<Any>
)

/**
* Set mapping from [type] to generated [KSerializer].

0 comments on commit 648894c

Please sign in to comment.
You can’t perform that action at this time.