Add Entity Classes
Entity classes are the tables in our Room database. By adding the @Entity annotation and a bit of configuration, we can convert a normal data class into a Room Entity. In case you’re wondering, we’ll be putting all the new classes in the data package.
We’re going to start with the Game that was used in the PennyDropDao class. This class will hold all the required information about a given game of Penny Drop but none of the player info. If we’re thinking about the real-life game, this represents the holder where the pennies are placed.
The Game class will contain a bunch of info: game start/end times, the game state, filled slots, the previous roll value, the turn text, and whether or not players can roll and pass. It will ...
Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.