Hi I'm trying to bother with KSP. I have a simple ...
# ksp
l
Hi I'm trying to bother with KSP. I have a simple use case: deserialize line of Strings coming from a csv file to a data class with type conversion. It might be overpowered to do this with KSP, but I would like to use this chance to learn annotation processing etc. Can someone give me a blueprint how this mapping with conversion would look like on the basis of an example (not the glue, just the processing code)? Or is someone aware of an example that matches my use case?
e
simple example attached. see lib/src/main/kotlin/ReflectCsv.kt for one approach to how do this reflectively; then build and see how lib/build/generated/ksp/main/kotlin/example/lib/example.kt is the moral equivalent minus reflection, and consider how you can generate that for any input
❤️ 1
l
wow thanks, that's all I need. Now I can imagine how it's done
p
If you only generate things based on the csv file KSP isn't the right tool. You are not inspecting any Symbols so a gradle task with caching will get it done simpler and more efficient
👍 1