I have been playing around with immutable POJO support in *org.jooq.codegen.DefaultGenerator*. This has been working well, but can be unwieldy when the POJO has more than 4-5 fields. From https://www.jooq.org/doc/3.12/manual/code-generation/codegen-pojos/ :
*immutablePojos: Immutable POJOs have final members and no setters. All members must be passed to the constructor* As Java lacks named parameters, calling the POJO constructor with many arguments can be confusing. Therefore I thought that something like https://immutables.github.io/factory.html#pojo-constructors would be a nice fix. The quickest implementation appeared to be overriding *JavaGenerator::generatePojoMultiConstructor* and inserting the necessary annotations. My first attempt is at https://github.com/azell/jooq-utils/blob/master/generators/src/main/java/com/github/azell/jooq_utils/generators/BuilderGenerator.java . Full POC can be found at https://github.com/azell/jooq-utils . I ended up copy and pasting almost all of the code from the *JavaGenerator* class. The builder-specific logic is 6 lines of code. Is there a better way to do this? -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/b10707e6-df9a-40a6-b0e1-b8317b05e563%40googlegroups.com.
