I'm trying to neglecting getter and setter in kotlin using @Parcelize. But little bit confused, here.
class College : Parcelable {
var studentFound = true
set(value) {
field = value
studentFoundEvents.onNext(value)
}
val studentFoundEvents = PublishSubject.create<Boolean>()
var sNumber: String? = null
var sLevel: String? = null
var course: Course? = null
set(value) {
field = value
cName = null
cId = null
cProf = null
}
}
and i have respective constructor(source: Parcel) {}, override fun writeToParcel(dest: Parcel?, flags: Int) {} and override fun describeContents(): Int = hashCode().
I want to do convert whole Parcelable to @Parcelize. Here is what i tried, but did not workout.
@Parcelize
data class College(
var studentFound = true,
val studentFoundEvents = PublishSubject.create<Boolean>(), // does not work here
var sNumber: String? = null,
var sLevel: String? = null,
var course: Course? = null
) : Parcelable
Is there is anything missing here? Thanks in Advance.