How to access enclosed element's Variable annotations in annotation processor?

214 views Asked by At

I am creating a string of data class for our API optimization like this

data class ex:

@MyAnnotation
data class Cast( 
     @Json(name = "cast_id") 
     val castId: Int, 

     val name: String, 

     @Json(name = "profile_path") 
     val profilePath: String? 
)

wanted result:

{"cast_id":1, "name":1, "profile_path":1}

but currently able to generate it

"{"castId":1, "name":1, "profilePath":1}"

I want access @JSON (or @SerializedName) annotation and its value, how do I get it?

then Using Kotlin poet to create class with this string init.

0

There are 0 answers