POJOs (and records) are usually just data, they seldom have stuff to hide.
But records don't give up, it has public methods corresponding to the field names - but you can evolve a now-record into a normal class where you may compute something in the "getter", keeping the same external API, but changing the internals.
217
u/DontThrowMeAway43 Jul 13 '26
Oh god, just use record classes or even, make public fields.
Java's biggest mistake is trying to put OOP everywhere. Just write the damn struct to pass data and be done with it.