jeudi 10 mars 2022

Kotlin class operation on its KProperties

I have a big Kotlin object and need to do some operations on specific properties. Here is a small example for demo:

class ObjectForAnalysis {
  var id: Int = 0
  lateinit var successful: SUCCESSFUL
  var job1: Job? = null
  var job2: Job? = null
  var job3: Job? = null
}

Imagine that I have multiple instances of the object above and that I need to do the following operation on the properties of type Job.

job !=null && job.computeSquare() < 1000

How could I achieve that ?





Aucun commentaire:

Enregistrer un commentaire