Seyed Jafari
06/25/2020, 8:11 PMinner class
reflectively using Kotlin-reflection library it's not hard except that I need to pass an instance of the parent class to the child class constructor.
Is there any function/way to get the KType
of parent class (without using it's name and Class.forName()
)?
here is an example of what I'm trying to achieve:
class Parent {
inner class Child()
}
fun main() {
val childType: KType = typeOf<Parent.Child>()
val parentType = childType.getParent()
}