Created
May 26, 2020 14:43
-
-
Save Ikhiloya/fb2b6add09c41fe303560a8f56154c94 to your computer and use it in GitHub Desktop.
Person data class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.model | |
| import androidx.room.Entity | |
| import androidx.room.PrimaryKey | |
| import com.google.gson.annotations.Expose | |
| import com.google.gson.annotations.SerializedName | |
| @Entity | |
| data class Person( | |
| @Expose(serialize = false) | |
| @PrimaryKey val localId: Int?, // local Person id | |
| @Expose(serialize = false) | |
| var id: Long?, // remote Person id | |
| @SerializedName("firstName") | |
| @Expose | |
| var firstName: String, | |
| @SerializedName("lastName") | |
| @Expose | |
| var lastName: String, | |
| @Expose(serialize = false) | |
| var state: String? | |
| ) { | |
| constructor(firstName: String, lastName: String, state: String?) : this( | |
| null, | |
| null, | |
| firstName, | |
| lastName, | |
| state | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment