I think the creation of holder classes, classes with just attritutes, get methods and set methods can be autogenerated. I understand that Eclipse is a defacto "standard" Java IDE these days. Does Eclipse do this? Do other IDEs?
I'm guessing the only reasons for making dedicated data holding classes instead of using HashMaps is to have mixed datatypes in a more visible/safter way and for the occasion when you want to DO something to the data when inserting it or retrieving it. Thoughts?
Yes. Eclipse Does this. To generate setter/getter, select the class in package explorer, right click -> Source -> Generate getter/setting.
Netbean also does this. Right click anywhere inside your class -> insert code-> setter/getter.
we do that to encapsulate the implementation details. you can find more explanations Why use getters and setters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With