Skip to content

Instantly share code, notes, and snippets.

@rostyslav-y rostyslav-y/Vehicle.kt
Last active Jun 16, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.