osecompanion.blogg.se

Serializable kotlin data class
Serializable kotlin data class












serializable kotlin data class

KMongo uses it to provide object mapping for Kotlin. Started in 3.5.0 (July 2017), the java driver introduces a new POJO mapping framework.

serializable kotlin data class

However, if you don't use already Jackson, you add a new quite complex library to your dependencies. If you need custom serialization or deserialization, you will not be blocked, you can implement it.Īlso, if you already use Jackson for json serialization (for rest services for example), the library is already in your list of dependencies. With the Jackson library, you get full support of one of the most powerful data-binding java engine, in order to map your data objects. How to choose the mapping engine ¶ The Jackson choice ¶ You have also the option to use custom Jackson modules or custom rialization modules. Use ObjectMappingConfiguration.addCustomCodec function in order to register a custom codec. If you need to check equality, use a method like OffsetDateTime#withOffsetSameInstant on the loaded date. So, in this case, the loaded date will not usually be equals to the saved date - the Instant part of the date of course is the same. Whatever is the timezone of the saved date, you will get an UTC date when loading the date from Mongo. For Calendar, ZonedDateTime, OffsetDateTime and OffsetTime, KMongo provides built-in support for these "Date" classes:ĭates are always stored in Mongo in UTC. appl圜onnectionString ( ConnectionString ( connection )).














Serializable kotlin data class