Hi. I have an interface which has a `name` and a `...
# serialization
j
Hi. I have an interface which has a
name
and a `value`:
Copy code
sealed interface MyInterface<T : Any> {
    val name: String
    var value: T

}
There's a bunch of subclasses which implement this interface with different types:
Copy code
class MyClass1(override var value: Boolean) : MyInterface<Boolean> {
    override val name: String = "Foo"
}
class MyClass2(override var value: String) : MyInterface<String> {
    override val name: String = "Bar"
}
I want to write a custom generic serializer which serializes these classes to/from a string of this format:
Copy code
"$name=${/* String Serialized form of value */}"
I have a list of these in a parent class, like this:
Copy code
class Parent {
    val myList: List<MyInterface<*>> = listOf()
}
Is it possible to serialize/deserialize
Parent
and ensure each member of the list is deserialized into the appropriate class instance? I'm not using JSON format. (I'm using KAML for YAML serialization)