Let's say I have a data class:
data class AnotherDataClass(
    val property: String,
    @KYC
    val annotatedProperty: String
)
And I want to retrieve all fields with a certain annotation. I do this:
anotherDataClass::class.memberProperties.filter {
     it.findAnnotation<KYC>() != null
}
It works fine.
What if I want to retrieve all fields from subclasses containing this variable like the example below?
data class DataClass(
    val other: String,
    @KYC
    val otherAnnotated: String
)
data class AnotherDataClass(
    val property: String,
    @KYC
    val annotatedProperty: String,
    val dataClass: DataClass
)
Is it possible to check the annotations recursively?
Aucun commentaire:
Enregistrer un commentaire