llkaarena.blogg.se

Serializable data class kotlin
Serializable data class kotlin









Imagine that we have the following simple map-like format (similar to json or any othe serialization format, isn’t it?):

serializable data class kotlin

Recently such functionality was implemented in Properties library.Īll code that you will see in this post can be found on github Let’s start! Spoiler: we will try to reimplement deserialization library for map-like format using kotlin compiler. We will try to create a deserialization library for the deserialization of our map-like format. Let’s start from the most important thing: from documentation!Īctually rialization has perfect huge guide about the serialization.īut we will try to be short and practical. Let’s have a look how this framework works and try to write our own serializer. We know a lot of different libraries for the serialization in Java,īut in Kotlin it was decided to create a common framework for the serialization In general they can be split into two main groups:īinary protocols ( pickle, protobuf and many other)Īnd protocols with a string representation like json,Ĭsv, e.t.c. There are a lot of different formats usedįor serialization. Of objects or sending these objects over the network.

serializable data class kotlin

Serialization and deserialization - are two sides of the same mechanism for storing (persisting)

serializable data class kotlin

Writing our own compiler plugin for serialization using Kotlin











Serializable data class kotlin