you can also just take the interface approach in Kotlin, works about as well
k
KayCee
04/28/2020, 2:38 AM
From my understandings, data class does not contain methods. A class name should be a noun. An abstract class needs abstract method. These are basic in java - kotlin. Why do you need abstract class in this case?
k
Krish
04/28/2020, 5:38 AM
Thanks for the responses thus far guys!
I don't need a abstract class specifically, I just want a way to avoid repeating myself many times for Common API parameters.
I have tried using interfaces but I cannot use the @SerialisedName GSON decorator within an interface. Also, if I do implement interfaces, would I have to initialize it with a value?
Ultimately I want to convert a JSON response to a Kotlin Object so I cannot initialize any vals in the data class itself as that is done when I call