Ayfri
12/07/2021, 9:22 AMKMutableProperty1<*, *>
for the members of my class ?
I only found memberProperties
which returns a list of KProperty<*, *>
and not castable so what should I use ?Roukanken
12/13/2021, 8:10 PMis KMutableProperty1<*, *>
check on the list should do it
add a filterIsInstance
which does the is check on whole collection and buala:
data class Example(
val one: Int,
var two: String,
val three: String,
var four: Int,
)
val mutableProperties: List<KMutableProperty1<*, *>> =
Example::class.memberProperties.filterIsInstance<KMutableProperty1<*, *>>()
mutableProperties.map { it.name to it.returnType }
// == [(four, <http://kotlin.Int|kotlin.Int>), (two, kotlin.String)]
Ayfri
12/13/2021, 8:15 PM