I'm new using kotlinpoet and I've been reading the documentation and it seems like a great library, but I could not find an example to solve my problem.
I have a dependency lib-domain-0.1.jar
in which I have business objects for example:
package pe.com.business.domain
data class Person(val id: Int? = null, val name: String? = null)
...
..
package pe.com.business.domain
data class Departament(val id: Int? = null, val direction: String? = null)
...
..
.
And I want to build a new dependency called lib-domain-fx-0-1.jar
where it has the same domains but with JavaFx properties (With tornadofx) for example:
package pe.com.business.domainfx
import tornadofx.*
class Person {
val idProperty = SimpleIntegerProperty()
var id by idProperty
val nameProperty = SimpleStringProperty()
var name by nameProperty
}
...
..
package pe.com.business.domainfx
import tornadofx.*
class Departament {
val idProperty = SimpleIntegerProperty()
var id by idProperty
val directionProperty = SimpleStringProperty()
var direction by directionProperty
}
...
..
.
My question is, how can I generate these files in lib-domain-fx-0-1.jar
by simply compiling my application with a gradle build? My project "lib-domain-fx-0-1.jar" is just a library, so it has no main class, so I do not know where to start the generation of code?. I have seen several examples in which they use @Annotations
and two different modules in the same project, but that is not what I need :(. I need to convert all classes of lib-domain-0.1.jar
to the JavaFx version with TornadoFX in another project (lib-domain-fx-0.1.jar
)
Thanks and regards.