Re:Lombok Saved My Ass
by foxyv on Monday November 18, 2019 @11:27AM
(#21565556)
I still can't figure it out. Why do people still use auto-generated Getters and Setters instead of just making the field public? What is the advantage of using Beans these days? I've never run into a situation where I wanted my getter/setter to do something other than return/set the value.
[ Parent
| on HN ]
Mostly just convention, but it's also a more flexible pattern. A public instance variable cannot have public reads, but private writes for instance.
There is also the case of derived properties. e.g.
LocalDateTime ranAt
LocalDateTime finishedAt
getRuntime() { ... }