Skip to content

Instantly share code, notes, and snippets.

@rostyslav-y
Last active June 16, 2017 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rostyslav-y/706475faa43eabe1b0928108404e3665 to your computer and use it in GitHub Desktop.
Save rostyslav-y/706475faa43eabe1b0928108404e3665 to your computer and use it in GitHub Desktop.
data class Vehicle(val id: Long,
val vin: Vin,
val ownerId: Long,
val plateNumber: String,
val manufacturer: String,
val model: String,
val bodyType: BodyType,
val color: Long) : VehicleModel {
override fun _id(): Long = id
override fun vin(): Vin = vin
override fun owner_id(): Long = ownerId
override fun plate_number(): String = plateNumber
override fun manufacturer(): String = manufacturer
override fun model(): String = model
override fun body_type(): BodyType = bodyType
override fun color(): Long? = color
companion object {
private val CREATOR = VehicleModel.Creator { _id, vin, owner_id, plate_number, manufacturer, model, body_type, color ->
Vehicle(_id, vin, owner_id, plate_number, manufacturer, model, body_type, color ?: 0L)
}
val FACTORY = VehicleModel.Factory(CREATOR, VinAdapter.INSTANCE, BodyTypeAdapter.INSTANCE)
val MAPPER = VehicleModel.Mapper(FACTORY)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment