Hello Kotlin experts! We have a mixed Kotlin/Java ...
# announcements
u
Hello Kotlin experts! We have a mixed Kotlin/Java project and would like to create data classes defined in Kotlin and use them in our Java code. We like using builders in our code and have used Lombok quite extensively in the past. My question is if there is a way to create automatic builders for Kotlin data classes (like Lombok does for Java classes) to avoid all the boilerplate of writing them by hand. Any suggestions?
s
You may not need a Lombok with Kotlin as its just one liner most of time to write a
data
type as opposed to java where you need to write lot of boilerplate
h
Read again what he wrote: He needs the builders to use the data classes from Java
s
Right. Thanks.
d
I don't know of an "automatic" way to do this but KotlinPoet (https://github.com/square/kotlinpoet) may help automate the generation of builders
u
Hmm nice library, but I was hoping to find something more “done”. Thanks for the pointer though.
👍 1