Issue
I’d like to mark some Room entity’s properties as internal. E.g.
@Entity(tableName "users")
class User {
// ...
@ColumnInfo(name "admin_id")
internal var adminId: String? null
}
However, this produce compile errors like: Error:(10, 1) error: Cannot find getter for field.
The only way how to make this works seems to use lateinit
modifier, though, it can’t be used for nullable neither primitive fields.
I’ve tried a “hack”: a private field with internal getter/setter, but that doesn’t work either.
The compiled generated version obviously adds some suffix to the generated methods (setAdminId$sdk_debug
) that doesn’t work with room. The “lateinited” field’s setters/getters have this suffix too, but the field stay itself public.
Is there any way how to make columns internal?
Solution
I didn’t solve this and I have to define new set of entities and mapper between them.
Answered By – hrach