mirror of
https://github.com/InsanusMokrassar/SDI.git
synced 2024-11-23 18:48:52 +00:00
ModuleSerializer now can be instantiated automatically
This commit is contained in:
parent
c8cae5c941
commit
dbd9c1b484
@ -3,6 +3,8 @@
|
|||||||
## 0.4.1
|
## 0.4.1
|
||||||
|
|
||||||
* `Serialization`: `1.1.0-RC` -> `1.1.0`
|
* `Serialization`: `1.1.0-RC` -> `1.1.0`
|
||||||
|
* `ModuleSerializer` now can be instantiated automatically
|
||||||
|
|
||||||
|
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|
||||||
|
@ -94,9 +94,16 @@ internal data class SerializationContext(
|
|||||||
|
|
||||||
@Serializer(Module::class)
|
@Serializer(Module::class)
|
||||||
class ModuleSerializer(
|
class ModuleSerializer(
|
||||||
private val moduleBuilder: (SerializersModuleBuilder.() -> Unit)? = null,
|
private val additionalClassesToInclude: Iterable<KClass<*>>,
|
||||||
private vararg val additionalClassesToInclude: KClass<*>
|
private val moduleBuilder: (SerializersModuleBuilder.() -> Unit)? = null
|
||||||
) : KSerializer<Module> {
|
) : 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()
|
private val jsonObjectSerializer = JsonObject.serializer()
|
||||||
override val descriptor: SerialDescriptor = jsonObjectSerializer.descriptor
|
override val descriptor: SerialDescriptor = jsonObjectSerializer.descriptor
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user