suresh
02/26/2020, 6:03 PMSerializable
class to see if there is a any common interface. What i am doing is,
@Serializable
data class TT(
val ciId: Long = -1,
val ciAttributes: Map<String, String?> = emptyMap()
) {
inline fun <reified T> asType(serializer: KSerializer<T>): T {
return Mapper.unmapNullable(serializer, ciAttributes)
}
}
val t: TT = ....
val x = t.asType(XX.serializer())
Robert Jaros
02/26/2020, 6:41 PMT::class.serializer()
?suresh
02/26/2020, 6:52 PMAny
suresh
02/26/2020, 6:53 PMsuresh
02/26/2020, 6:53 PMsandwwraith
02/27/2020, 8:57 AMtypeOf
stdlib function) helpful: https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/commonMain/src/kotlinx/serialization/SerializerResolving.kt#L29suresh
02/27/2020, 5:06 PM