Skip to content

Instantly share code, notes, and snippets.

@ngallazzi
Created January 8, 2021 15:27
Show Gist options
  • Save ngallazzi/7a886617410fe7bb9fdf95d22bfc3442 to your computer and use it in GitHub Desktop.
Save ngallazzi/7a886617410fe7bb9fdf95d22bfc3442 to your computer and use it in GitHub Desktop.
class BookEntityMapper {
fun toBookEntity(volume: Volume): BookEntity {
return BookEntity(
id = volume.id,
title = volume.volumeInfo.title,
authors = volume.volumeInfo.authors,
imageUrl = volume.volumeInfo.imageUrl
)
}
fun toVolume(bookEntity: BookEntity): Volume {
return Volume(
bookEntity.id,
VolumeInfo(bookEntity.title, bookEntity.authors, bookEntity.imageUrl)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment