Hey there. Is there a solid way to collect all pro...
# reflect
h
Hey there. Is there a solid way to collect all properties of a class included parent-class properties? With my current approach, it misses the fields of the parent class:
Copy code
open class Person(val name: String)
class Manager(name: String, val isCEO:Boolean) : Person(name)

val declaredMembers = Manager::class.declaredMembers

val properties = declaredMembers
            .filter { it.parameters.toList().size == 1 }
            .filter { it is KProperty }
Usecase: https://github.com/holgerbrandl/krangl/blob/60308cabde760a16fe31782c191b4799da9ba7c9/src/main/kotlin/krangl/Builder.kt#L53 where I'd like to fix it in a way that also super-class attributes are considered.
d
Use
members
instead of
declaredMembers
h
OMG how could i miss that. Thanks @diesieben07