When deserializing a class with Moshi it fails on by lazy
property with error:
IllegalArgumentException: No JsonAdapter for interface kotlin.Lazy annotated []
So I want to tell Moshi to ignore the property. The way to ignore this is apparently to use @Transient
however that can only be used on a field - not a property.
So how to ignore Kotlin lazy properties when deserializing with Moshi?
You can annotate the delegate itself:
class Foo {
@delegate:Transient
val bar by lazy { true }
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.