fixes in ModuleSerializer

This commit is contained in:
InsanusMokrassar 2021-06-05 16:16:59 +06:00
parent 6de0f26190
commit d55a8495da

View File

@ -97,12 +97,6 @@ class ModuleSerializer(
private val additionalClassesToInclude: Iterable<KClass<*>> = emptyList(),
private val moduleBuilder: (SerializersModuleBuilder.() -> Unit)? = null
) : KSerializer<Module> {
constructor() : this(emptyList()) // to be able to create default instance
constructor(
moduleBuilder: (SerializersModuleBuilder.() -> Unit)? = null,
vararg additionalClassesToInclude: KClass<*>,
) : this(additionalClassesToInclude.toList(), moduleBuilder)
private val jsonObjectSerializer = JsonObject.serializer()
override val descriptor: SerialDescriptor = jsonObjectSerializer.descriptor
@ -160,4 +154,9 @@ class ModuleSerializer(
}
}
fun ModuleSerializer(
moduleBuilder: (SerializersModuleBuilder.() -> Unit)? = null,
vararg additionalClassesToInclude: KClass<*>
) = ModuleSerializer(additionalClassesToInclude.toList(), moduleBuilder)
val DefaultModuleSerializer = ModuleSerializer()