Hello, I'm curious, is there an idiomatic way to know at run time if an Any object is serializable ?
c
Casey Brooks
10/30/2020, 9:37 PM
Automatically? Not really. There are no “marker” annotations, interfaces, or anything else added to serializable classes. On JVM you can look up a serializer via reflection, but that doesn’t work on MPP
The “idiomatic” way of knowing if an object is serializable is to pass its KSerializer wherever you’re trying to serialize it
👍 3
g
Gilles Barbier
11/01/2020, 11:11 AM
If I have a set of classes that I know to be Serializable, then how can I do something like:
Copy code
myClassList.map { ... do something with it.serialiser() }