On the JVM platform, there’s a reflection API function that returns the Kotlin property that corresponds to a field. Is there a way to get the Kolin property that corresponds to the JVM method that is the property’s getter?
d
DALDEI
04/30/2019, 11:50 AM
use kotlin reflection.
Given a jvm class Class<*> jvm; with a public method
String getMyPropertuy();
Using kotlin code:
val klazz = jvm.kotlin // gets a KClass from a Class
val kprop = klazz:declaredMemberProperties.first{ name == "myProperty" }