Just what are JavaBeans in the first place? (Those of you who are familiar with JavaBeans may want to skip forward.) JavaBeans are, in their simplest form, classes that contain certain patterns or signatures of methods. But JavaBeans are much more than simple classes; they are classes that implement the concept of a component. And what is a component? A component is best described by listing its characteristics:
Components are reusable.
Components require little effort to use on the part of the application developer.
Components allow for rapid prototyping.
Components often support visual programming and the drag-and-drop paradigm.
JavaBeans go a step further than simple components and have a number of additional benefits.
JavaBeans are
Portable (written in Java, of course!)
Object-oriented
Dynamic
Robust
Simple to develop and use
Perhaps one of the best features of JavaBeans is that they scale down as well as up. As we shall see in the next few sections, any class can be a JavaBean as long as it follows a few simple conventions.
Specifically, the JavaBean 1.0 specification states that "A Bean is a reusable software component that can be manipulated visually by a builder."
We won't get into all aspects of JavaBeans here. There are several excellent references at the end of this chapter, but we will look at one aspect in detail: how to create and persist a JavaBean using XML.
18.188.20.56