Using Reflection i want to get only public members:
class MyClass
{
public var pubVar = “pubVar”
private var pvtVar = “pvtVar”
}
(MyClass::class.declaredMemberProperties) lists both public & private members.
How to get only public members?
Using Reflection i want to get only public members:
class MyClass
{
public var pubVar = “pubVar”
private var pvtVar = “pvtVar”
}
(MyClass::class.declaredMemberProperties) lists both public & private members.
How to get only public members?
Check the visibility of its getter:
MyClass::class.declaredMemberProperties.filter { it.getter.visibility == KVisibility.PUBLIC }