07/25/2022, 1:21 PM
Kotlin enforce data class type I have various types of events in my application that are represented by Data classes. All events must have an attribute called EventContent that stores additional data about the event in String format. These events are saved to a database and EventContent is serialized into a JSON via kotlin.x.serialization. To enforce this, I have used an interface like this on a sample event called ShutdownEvent: interface Event { var eventContent: String } data class ShutdownEvent( override var...