Reputation: 457
class A{
private var p:MyObj? = null
}
It seems that I can't get p by A::p, Or I can only get it by java?
My kotlin version is
ext.kotlin_version = '1.1.4-2'
Upvotes: 2
Views: 1802
Reputation: 9448
You can't get it because you do it outside of that class when the property is private
. You have a few options here:
this::p
(fun func(): KProperty0<MyObj?> = this::p
)public
A::class.memberProperties.find { it.name == "p" } as KProperty1<A, MyObj?>
Upvotes: 2