Feauture idea @Setter(trackUpdate = true)

49 views
Skip to first unread message

Giorgio Spilorcio

unread,
May 27, 2025, 2:49:14 PMMay 27
to Project Lombok
I wanted to ask for an opinion about this idea that I would find useful:

I have some simple data classes annotated with @Setter or @Data, i have a list of these data classes that can change value as the program does its job, however at the end these must be saved.

If you use a database you need to make a query to replace the updated values, however some of this data classes might have not changed at all, so you introduce an `updated` field that is defaults to false and becomes true if any setter has been triggered. And we replace the record in the database only if `updated` is true.

This is a simple case with @Setter(trackUpdate = true), however if we need to be fully correct we might need a @TrackUpdate field that updates said `updated` field whenever we set a field in a method that isn't a constructor.
Reply all
Reply to author
Forward
0 new messages