Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

401
Views
Cómo ignorar un archivo de Entidad con Habitación

Tengo una clase de datos de la que creé una Entity para mi base de datos.

esta es mi clase de datos:

 @Entity @Parcelize data class Tapligh( @PrimaryKey(autoGenerate = true) var id: Long, @SerializedName("title") var title: String?, @SerializedName("type") var type: Int?, @SerializedName("os") var os: Int?, @SerializedName("logo") var logo: String?, @SerializedName("template") var template: String?, @SerializedName("action") var action: String?, @SerializedName("date") var date: String?, @Embedded @SerializedName("videos") var videos: Videos?, ) : Parcelable { fun getTaplighType(): Int { return when (this.type) { 0 -> TaplighType.IMAGE.type 1 -> TaplighType.VIDEO.type else -> TaplighType.NATIVE.type } } } @Parcelize data class Videos( @SerializedName("land") var land: String?, @SerializedName("port") var port: String? ) : Parcelable

Ahora, al agregar el siguiente campo en mi clase de datos Tapligh , obtendré un error:

 @Ignore @SerializedName("images") var images: List<String>?

Estoy recibiendo este error:

 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). public final class Tapligh implements android.os.Parcelable { ^
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

@Ignore en las clases de Kotlin requiere un valor de parámetro predeterminado y una anotación @JvmOverloads :

 data class Tapligh @JvmOverloads constructor( ... @Ignore @SerializedName("images") var images: List<String>? = null )
over 4 years ago · Santiago Trujillo Report

0

A veces, un nuevo campo crea un error cuando la clase implementa Parcelable, así que intente eliminar Parcelable y el cuerpo de la clase, coloque Parcelable e implemente los miembros nuevamente o simplemente implemente la interfaz Serializable en lugar de Parcelable.

over 4 years ago · Santiago Trujillo Report

0

El Taplight provisto tiene errores:

 @PrimaryKey(autoGenerate = true) var id: Long, @SerializedName("title") var title: String?, @SerializedName("type") var type: Int?, @SerializedName("os") var os: Int?, @SerializedName("logo") var logo: String?, @SerializedName("template") var template: String?, @SerializedName("action") var action: String?, @SerializedName("date") var date: String?, @Embedded @SerializedName("videos") var videos: Videos?) { constructor() : this(0,null,null,null,null,null,null,null,null)

videos parece el último argumento y el constructor fue mal llamado. No sé si fue un error de copiar y pegar o de formato, pero espero que pueda ayudar.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!