Jason Feng
09/18/2019, 6:14 AMdata class or class with lateinit var, those field in entity mostly don’t have default valuethanksforallthefish
09/18/2019, 6:50 AMthanksforallthefish
09/18/2019, 6:53 AMvar are better off than data classes, you can also have
class Entity(
var id: String,
...,
var middleName: String? = null)
and I suggest to have preinitialized values at the bottom of the constructor list, so you can do Entity(mandatoryOne, mandatoryTwo). if you have optional values in the middle of the parameter list, you would have to pass them as wellCzar
09/18/2019, 8:45 AMleodeng
09/18/2019, 2:27 PMLuis Munoz
09/19/2019, 3:38 PMleodeng
09/19/2019, 4:28 PM@MyNoArgConstructorAnnotation
class MyEntity(
var id: Long,
var name: String
) : BaseEntity(id)leodeng
09/19/2019, 4:48 PM