EntityMapper

EntityMapper used for creating cache or remote mapper.

Example:

data class Student(val name: String)
data class StudentResponse(val id: Int, val name: String)

class StudentMapper : EntityMapper<StudentResponse, Student> {
override fun mapFromEntity(entity: StudentResponse): Student {
return Student(entity.name)
}

override fun mapToEntity(domainModel: Student): StudentResponse {
return StudentResponse(-1, domainModel.name)
}
}

Since

1.3.0

Functions

Link copied to clipboard
abstract fun mapFromEntity(entity: Entity): DomainModel
Link copied to clipboard
abstract fun mapToEntity(domainModel: DomainModel): Entity