Hi ! I am making utils for reflection with kotlin....
# server
s
Hi ! I am making utils for reflection with kotlin. However, I would like to get information through Annotation about what to change to when the variable is classed. However, after debugging, not only the field of Annotation but also the Annotation itself could not be searched in Reflection. How can I approach it?
Copy code
@Target(AnnotationTarget.FIELD)
@Retention(AnnotationRetention.RUNTIME)
annotation class ReflectionTarget(
    val clazz: KClass<out Any> = Any::class,
)
Copy code
data class UserInfo(
    val name: String,
    @ReflectionTarget(clazz = UserDetailsResponse::class)
    val userDetails: UserDetails,
)

data class UserDetails(
    val age: Int,
    val email: String,
)
How can I get the information of annotation and the field of annotation by reflection using the code below on runtime?