小编Tio*_*ing的帖子

当我构建应用程序时,如何使用 KotlinPoet 生成代码?(摇篮)

我是 kotlinpoet 的新手,我一直在阅读文档,它似乎是一个很棒的库,但我找不到解决我的问题的示例。

我有一个依赖项lib-domain-0.1.jar,其中有业务对象,例如:

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)
...
..
.
Run Code Online (Sandbox Code Playgroud)

我想构建一个新的依赖项,lib-domain-fx-0-1.jar它具有相同的域,但具有 JavaFx 属性(使用 Tornadofx),例如:

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 …
Run Code Online (Sandbox Code Playgroud)

build gradle kotlin kotlinpoet

7
推荐指数
1
解决办法
2657
查看次数

标签 统计

build ×1

gradle ×1

kotlin ×1

kotlinpoet ×1