I want to use the values of all properties that have some annotation. For the most part my code works, I get all the properties and only take those that have that annotation.
private inline fun <reified A : Annotation> (target: Any) {
target::class.memberProperties
.filter { it.annotations.any { annotation -> annotation is A } }
.forEach {
// How do I get the value here?
}
}
I wanted to use it.get(...)
but get
expects a Nothing
as parameter. Same goes for getter
. Calling it.call(target)
does work but it looks wrong since there is an actuall get
which I don't know how to invoke.
So what is the correct way of getting the properties value?
Aucun commentaire:
Enregistrer un commentaire