I got an entity for Android Room which looks like that. So far, no worries.
@Entity(tableName = "users",
indices = arrayOf(Index(value = "nickName", unique = true)))
data class User(@ColumnInfo(name = "nickName") var nickName: String,
@ColumnInfo(name = "password") var password: String) {
@ColumnInfo(name = "id")
@PrimaryKey(autoGenerate = true)
var id: Long = 0
}
Now I need to encrypt the password. With Java, this would simply be done with a setter and that would work.
How would you do that with Kotlin. I cannot find a solution to combine Android Room, custom setters and data classes.