Advertisement
Guest User

Untitled

a guest
Sep 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.92 KB | None | 0 0
  1.  
  2. Error!!
  3.  
  4. e: error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  5.  
  6.  
  7.  
  8.  
  9. @Entity(tableName = "NewsEntity")
  10. class NewsEntity(
  11.         @PrimaryKey
  12.         var id: String = "",
  13.         var title: String = "",
  14.         var link: String = "",
  15.         var description: String = "",
  16.         var favourite: Boolean = false) {
  17.  
  18.  
  19.     constructor() : this("", "", "", "", false)
  20.  
  21.     @Ignore
  22.     constructor(model: NewsItem) : this() {
  23.         title = model.title
  24.         link = model.link
  25.         description = model.description
  26.         id = "${model.title}${model.link}"
  27.     }
  28.  
  29.     companion object {
  30.  
  31.         const val ID = "id"
  32.         const val TITLE = "title"
  33.         const val LINK = "link"
  34.         const val DESCRIPTION = "description"
  35.         const val FAVOURITE = "favourite"
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement