Data class inheritance


#1

Let’s say I have an independent java module (library) which is used to generate sets of data classes (like Course, Exam, Teacher). Then when I want to use the library in Android I would like to extend these data classes and add some Android specific features, like implementing Parcelable, adding new properties (e.g. id for DB, etc.) and new constructors. I did this in Java, but since inheritance of data classes is not supported in Kotlin, the only workaround I see is to create a new data class in Android module which would have exactly the same properties and functions + new ones. I would also add a constructor which takes “base” data class. So I wonder: Is this a good design? Why or why not? Are there any alternative approaches?