Possible optimized record construction in order to use as DTO
John Hendrikx
hjohn at xs4all.nl
Thu Jan 11 23:08:32 UTC 2024
You can consider using an annotation processor to create builders for
such records -- for records with that many parameters, that's probably a
good idea anyway.
Although Lombok is often used for this, there are alternatives as well.
I can recommend taking a look at
https://github.com/Randgalt/record-builder
If you are only "mapping" such records instead of creating them
manually, you may take a look at mapping frameworks (like mapstruct).
--John
------ Original Message ------
>From "Roel Meeuws" <r.j.meeuws at gmail.com>
To "Pedro Lamarão" <pedro.lamarao at prodist.com.br>
Cc amber-dev at openjdk.org
Date 11/01/2024 14:59:55
Subject Re: Possible optimized record construction in order to use as
DTO
>Hi Pedro,
>
>My editor will also insert these, but:
> * not all my colleagues have that in their editors
> * The perceived formatting is impacted by inserting these words
>between the text
> * This is not working for me in e.g. Eclipse when the method call is
>not finalized yet or there is a compile error (because I am still
>typing).
>
>Roel
>
>--------------------------------------------
>Roel Meeuws
>Email: r.j.meeuws at gmail.com
>Mob. phone: +31 (0)6 10 82 44 01
>--------------------------------------------
>
>
><http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>Virus-free.www.avg.com
><http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
><#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>Op do 11 jan 2024 om 14:50 schreef Pedro Lamarão
><pedro.lamarao at prodist.com.br>:
>>Hello! My observation is below.
>>
>>Em qui., 11 de jan. de 2024 às 09:50, Roel Meeuws
>><r.j.meeuws at gmail.com> escreveu:
>>
>>>now let's construct this:
>>>var line = new IrritatinglyBigEUReportLine(
>>> 12345,
>>> ZonedDateTime.now(),
>>> "John",
>>> "Doe",
>>> "529900T8BM49AURSDO55",
>>> BigDecimal.valueOf("100.0"),
>>> BigDecimal.valueOf("100.0"),
>>> BigDecimal.valueOf("100.0"),
>>> BigDecimal.valueOf("100.0"), // anyone knows what this value is
>>>here?
>>> ...
>>>);
>>
>>I think this is an interesting usability problem that has many
>>solutions.
>>My IDE, for example, puts a small widget in front of that line,
>>showing the name of the parameter.
>>I suspect many good editors today will show the name of the parameter
>>with some UX gesture, such as mouse rovering, or placing the caret at
>>the position and doing some key combination.
>>Many such problems are best solved by the editor.
>>
>>--
>>Pedro Lamarão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240111/0bbbeeef/attachment-0001.htm>
More information about the amber-dev
mailing list