@JsonClass can't be applied to [class], RealmObject is not Kotlin typepublic

i bumped on a problem with setting up my Realm instances with Moshi annotations. Haven’t found any similar problems.

Model classes below

FormField.kt

@JsonClass(generateAdapter = true)
open class FormField(

    @Json(name="fieldId")
    private var fieldId: String? = null,
    @Json(name="fieldName")
    private var fieldName: String? = null,
    @Json(name="fieldType")
    private var fieldType: String? = null,
    @Json(name="isRequired")
    private var isRequired: Boolean? = null
): RealmObject()

Form.kt @JsonClass(generateAdapter = true) open class Form(

    @Json(name="data")
    private var formFields: RealmList<FormField>? = null,
    @Json(name="name")
    private var name: Boolean? = null,
    @Json(name="description")
    private var description: Boolean? = null,
    @Json(name="error")
    private var error: Boolean? = null,
    @Json(name="message")
    private var message: String? = null,
    @Json(name="status")
    private var status: String? = null
): RealmObject()

And errors im receiving

@JsonClass can't be applied to com.example.dynamicforms.data.entity.Form: supertype io.realm.RealmObject is not a Kotlin type
public class Form extends io.realm.RealmObject {
       ^

@JsonClass can't be applied to com.example.dynamicforms.data.entity.FormField: supertype io.realm.RealmObject is not a Kotlin type
public class FormField extends io.realm.RealmObject {
       ^

Thanks in advance for any help :)

解决方案:

Code compiles after deleting @JsonClass(generateAdapter = true), but isn’t it harm since im removing my adapter. For what i know it was taking care of reflection. Hopefully it won’t be problem in future.

本文来自投稿,不代表运维实战侠立场,如若转载,请注明出处:https://www.shizhanxia.com/421.html

(0)
上一篇 2022年6月29日 下午3:56
下一篇 2022年6月29日 下午3:56

相关推荐

发表评论

登录后才能评论