JavaBean
From APIDesign
(New page: Specification for designing reusable components in Java.) |
|||
Line 1: | Line 1: | ||
- | Specification for designing reusable components in [[Java]]. | + | Specification for designing reusable components in [[Java]]. A [[JavaBean]] is a '''public''' class with default (no argument) constructor. It is accompanied by a set of properties (defined by standardized [[GettersAndSetters]]) and events, listeners. The [[JavaBean]] specification was probably the first ever specification in [[Java]] that used the [[wikipedia::Convention_over_Configuration]] paradigm. It is enough to name setters as ''setXYZ'' and getters as ''getXYZ'' and the automatic introspection mechanism recognizes them as properties. The same applies to listeners - it is enough to have pair of ''addXYZListener(XYZListener)'' and ''removeXYZListener(XYZListener)'' methods and the system automatically recognizes them as event source. If these conventions are not enough, the [[JavaBean]] class can be associated with additional information in form of ''BeanInfo'' class. |
Revision as of 11:39, 20 September 2009
Specification for designing reusable components in Java. A JavaBean is a public class with default (no argument) constructor. It is accompanied by a set of properties (defined by standardized GettersAndSetters) and events, listeners. The JavaBean specification was probably the first ever specification in Java that used the wikipedia::Convention_over_Configuration paradigm. It is enough to name setters as setXYZ and getters as getXYZ and the automatic introspection mechanism recognizes them as properties. The same applies to listeners - it is enough to have pair of addXYZListener(XYZListener) and removeXYZListener(XYZListener) methods and the system automatically recognizes them as event source. If these conventions are not enough, the JavaBean class can be associated with additional information in form of BeanInfo class.