blaze-persistence
blaze-persistence copied to clipboard
Improve developer experience of generated builders for entity views
Currently, the usage of the builders is quite cumbersome. For example in Kotlin:
CatViewBuilder.Init(mapOf()).apply {
name = "some name"
}.build()
I would like the usage to be like this instead:
CatViewBuilder.build {
name = "some name"
}
The static build
method could be defined as follows:
public static CatView build(Consumer<CatViewBuilder.Init> builderFunction) {
CatViewBuilder.Init builder = new CatViewBuilder.Init(...)
builderFunction.accept(builder)
return builder.build()
}
Ideally (and if possible), the method should be defined generically in a base interface (e.g. EntityViewBuilderBase
).