Sunday, February 13, 2011

Some more topics

Continuing...

JavaBeans Standards
Properties (private instance of variables) can only be accessed by getters and setters methods that is respectively getName and setName. In the case of boolean properties can use isName as the getter method. Those methods must be public. The return/argument type must matches for the type of the property.

Listeners (objects that receives informations when some specific event occurs) must end the methods with "Listener". There is the addXXXListener method to register and the removeXXXListener to remove it. Both have argument and returns void. The XXX is the type of the listener. If we have some like "removeJusticeListener(TestListener t)" is wrong due instead of "TestListener" it should be "JusticeListener".