Re: Builder pattern for Java records

2021-05-22 Thread Brian Goetz
2021 22:35 > Para: Alberto Otero Rodríguez > Cc: core-libs-dev@openjdk.java.net > Asunto: Re: Builder pattern for Java records > > There is no end to patterns of code that could be generated by tools, and for > each of them, one can imagine situations where they would be useful.

RE: Builder pattern for Java records

2021-05-22 Thread Alberto Otero Rodríguez
Cc: core-libs-dev@openjdk.java.net Asunto: Re: Builder pattern for Java records There is no end to patterns of code that could be generated by tools, and for each of them, one can imagine situations where they would be useful. But in addition to the other reply about how builders are really

Re: Builder pattern for Java records

2021-05-22 Thread Brian Goetz
There is no end to patterns of code that could be generated by tools, and for each of them, one can imagine situations where they would be useful. But in addition to the other reply about how builders are really only called for when there are a large number of _optional_ components, the premise

Re: Builder pattern for Java records

2021-05-21 Thread -
As far as I see, builders are more useful when there are too many arguments or a lot of them have default values. These needs aren't as significant as on records where few components are inferred. In addition, using builders may lead to extra object allocation and increase distribution size for th

Builder pattern for Java records

2021-05-21 Thread Alberto Otero Rodríguez
Hi, I have found this project on GitHub which creates a Builder for Java records: https://github.com/Randgalt/record-builder [https://opengraph.githubassets.com/a4e3a7b3c7b16b51e0854011fe4b031577bcc09919058baef412b03613295d20/Randgalt/record-builder] Git