JavaBean
From APIDesign
Line 1: | Line 1: | ||
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 [[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. | 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 [[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. | ||
- | + | [[Category:APIDesignPatterns]] | |
- | + | ||
- | + |
Current revision
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 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.