mirror of
https://github.com/InsanusMokrassar/SDI.git
synced 2024-12-26 18:47:26 +00:00
now Module is not serializable and instead of Serializer was created ModuleDeserializationStrategy
This commit is contained in:
parent
cee263adb6
commit
2748c3f861
@ -3,7 +3,8 @@
|
||||
## 0.1.2
|
||||
|
||||
* All reflection support methods are internal
|
||||
* Added `lodModule` functions for more useful working with modules loading
|
||||
* Added `loadModule` functions for more useful working with modules loading
|
||||
* `Module` now is not serializable and can be created only via `loadModule` functions
|
||||
|
||||
## 0.1.1
|
||||
|
||||
|
@ -4,4 +4,4 @@ import kotlinx.serialization.ImplicitReflectionSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
fun loadModule(json: String): Module = Json.nonstrict.parse(Module.serializer(), json)
|
||||
fun loadModule(json: String): Module = Json.nonstrict.parse(ModuleDeserializerStrategy, json)
|
||||
|
@ -6,13 +6,10 @@ import kotlinx.serialization.internal.HashMapSerializer
|
||||
import kotlinx.serialization.internal.StringSerializer
|
||||
import kotlinx.serialization.json.*
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
@Serializable(ModuleSerializer::class)
|
||||
class Module(base: Map<String, @ContextualSerialization Any>) : Map<String, Any> by base
|
||||
class Module internal constructor(base: Map<String, @ContextualSerialization Any>) : Map<String, Any> by base
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
@Serializer(Module::class)
|
||||
internal object ModuleSerializer : KSerializer<Module> {
|
||||
internal object ModuleDeserializerStrategy : DeserializationStrategy<Module> {
|
||||
private val internalSerializer = HashMapSerializer(StringSerializer, ContextSerializer(Any::class))
|
||||
override val descriptor: SerialDescriptor
|
||||
get() = internalSerializer.descriptor
|
||||
@ -27,7 +24,5 @@ internal object ModuleSerializer : KSerializer<Module> {
|
||||
return Module(map)
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, obj: Module) {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
override fun patch(decoder: Decoder, old: Module): Module = throw UpdateNotSupportedException("Module")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user