Component Development Using JavaBeans

Component Development Using JavaBeans

JavaBeans is a platform-neutral, component architecture for the Java application environment. The JavaBeans specification defines a set of standard component software APIs for the Java platform. The specification was developed by Sun with a number of leading industry partners and was then refined based on broad general input from developers, customers, and end users during a public review period. While the interactive development tools mentioned above support JavaBeans development, you do not need one of these tools to start developing your own JavaBeans. All you need to write a JavaBean is the Beans Development Kit (BDK) and the Java Development Kit (JDK, version 1.1 or higher). Both the BDK and JDK are available for free download from Sun's Java web site at

A JavaBeans component can be part of both Java applets and Java applications. Because JavaBeans is part of the core JDK 1.1 capability, any JDK 1.1 compliant browser or tool implicitly supports JavaBeans. JavaBean components are generally referred to simply as "Beans." Development tools that support beans usually have some sort of palette or toolbox that lets you view the beans in a particular directory or set. Using the Introspection capability defined in the JavaBeans API, the builder tool can look inside beans and learn their characteristics and parameters. This allows the builder tool to create customization forms for each bean. For instance, a bar chart bean might allow you to set the number of bars and their color . This information would be displayed on the bean's customization form by the builder tool for the developer to edit.

Besides learning about the parameters of a bean that can be modified, Introspection also determines the methods exported and the events generated or handled by a bean. Introspection relies on the core Java reflection API to discover these bean features. This is possible based in part on the design patterns and naming conventions followed by beans. For instance, the "get" preface to a method always specifies an exported parameter and the "set" preface to a method always specifies a settable parameter. In addition to naming conventions, beans can have a related bean information class that defines parameter, method, and event information.

The bean features exposed during introspection can be customized by the developer using standard forms, called property sheets, that are generated by builder tools. Beans with more complicated features may define their own more sophisticated bean customizers.

Beans use events to communicate with other beans. A bean that wants to receive events registers its interest with the bean that generates the event. Builder tools can examine a bean and determine which events that bean can send and which it can receive. Persistence enables beans to save their state, and restore that state later. JavaBeans uses Java Object Serialization to support persistence.

Software Development. Building Reliable Systems
Software Development: Building Reliable Systems
ISBN: 0130812463
EAN: 2147483647
Year: 1998
Pages: 193
Authors: Marc Hamilton © 2008-2017.
If you may any questions please contact us: