Krzysztof Kocel
07/18/2019, 9:14 AMclass User {
var id: String? = null
var name: String? = null
}
and list of pairs:
val fieldsToChange = listOf<Pair<String, String>>(Pair("name", "foo"), Pair("id", "bar"))
I would like to iterate trough list of pairs and set appropriate values for given properties using reflection.
How I can achieve this using kotlin reflection?kralli
07/18/2019, 9:24 AMKrzysztof Kocel
07/18/2019, 9:28 AMdiesieben07
07/18/2019, 9:42 AMUser::class.memberProperties.find { it.name == "name" }
Karolis
07/18/2019, 9:49 AM