please, dont try to kill me with all the “only accessors are right” talk… I came in peace 🙂
I just kindly want to ask, what is the main reason, that Java Beans MUST use accessors even in situations only simple attribute access is required. I know accessors are good thing, in certain situations. But, as my favourite article says, “dont use accessors, unless you are 100% certain you need more than simple atribute access, they are waste of CPU and programmer time”.
Again, please, dont attack me for not using accessors all the time. I only ask, what is the reason it HAS to be used in order to use and create proper Java Bean. Why people at Oracle said lets do it this way… Thanks.
Java beans are a convention. Frameworks that work with Java beans rely on the details of that convention to reliably manipulate objects.
There’s actually a good explanation on wikipedia: http://en.wikipedia.org/wiki/JavaBean