Skip to content

Instantly share code, notes, and snippets.

@Ikhiloya
Created May 26, 2020 14:43
Show Gist options
  • Select an option

  • Save Ikhiloya/fb2b6add09c41fe303560a8f56154c94 to your computer and use it in GitHub Desktop.

Select an option

Save Ikhiloya/fb2b6add09c41fe303560a8f56154c94 to your computer and use it in GitHub Desktop.
Person data class
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