I want to add a delegated property to my Composition
class, as follows
@Entity
data class Composition(
val author: String="",
val background: String?,
val description: String="",
val downloadURL: String="",
val duration: String="",
val headPortrait: String?,
@PrimaryKey val id: String,
val isLike: Boolean,
val likeAmount: String="",
val playingAmount: Int=0,
val replyAmount: String?,
val showStyle: String?,
val title: String?,
val userId: String?,
val commentAmount: String?,
val cover: String=""
){
val showDuration by lazy{
val minutes = duration.toInt() /60
val seconds =duration.toInt()%60
"$minutes:$seconds"
}
}
But there gona be a compile error because delegated property can not be saved in database. So i want to
add an
Ignore
annotation to this field. What a pity that Androidstuio will throws a complain "This annotation is not applicable to target 'member property with delegate" . Who has ideas for this problem?
As user IR42 points out in his comment, you can use @delegate:Ignore
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With