Skip to content

Instantly share code, notes, and snippets.

@mohashari
Created June 28, 2018 17:43
Show Gist options
  • Select an option

  • Save mohashari/bc3dc3e1d394ee055caf80fea6c6474d to your computer and use it in GitHub Desktop.

Select an option

Save mohashari/bc3dc3e1d394ee055caf80fea6c6474d to your computer and use it in GitHub Desktop.
package com.codecika.kotlindemo.converter
import com.codecika.kotlindemo.model.domain.Student
import com.codecika.kotlindemo.vo.StudentVO
fun Student.toVO(): StudentVO {
return StudentVO(
name = name,
address = address,
birthday = birthday
)
}
fun StudentVO.toModel(): Student {
return Student().apply {
name = this@toModel.name
address = this@toModel.address
birthday = this@toModel.birthday
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment