JavaBeans : Java Glossary
A standard for Java componentware. It functions much like Microsoft’s
Windows-specific Visual Basic pluggable components. The JavaBeans
APIs (Application Programming Interfaces)
allow ISVs (Independent Software Vendors) to develop reusable software components that end-users
can then hook together using visual application builder tools, such as
Inprise’s JBuilder, IBM (International Business Machines) ’s Visual Age, SunSoft’s Java Workshop and
Symantec’s Visual Café. For example, Visual Café Pro has already
created many smart components to give Delphi-like abilities to crank out
SQL (Standard Query Language) database applications. JavaBeans have persistence
(with serialised customised objects stored in *.ser pickle files), properties, events
and methods that are exposed to the GUI (Graphic User Interface)
designer. They also support introspection so that
builder tools can examine them to figure out what properties and methods they
Writing a Bean is easy.
Usually beans are bundled up with their corresponding BeanInfo classes into jar files.
- They require a public parameterless default constructor.
- Beans must be totally freestanding. They can’t presume anything has been
done for them ahead of time. If they need it, they have to create it or fake it for
themselves. For example, they can’t presume some static call has been done to
set up a Window for them to display error messages. Beans are like little reptiles
that must be able to fend for themselves the moment they hatch (are
- A bean has no special interface to implement, just the dummy Serializable. There is a formal
- Just use the standard getXXX, setXXX naming conventions for your properties and
make public the ones you want to expose. You can hide some of the public properties
later in your BeanInfo to give you the Delphi-like
distinction between public and published.
- String properties should be initialised to "" or some value rather
- Provide a BeanInfo class to describe the properties.
BeanInfo classes can get pretty elaborate, but writing a
minimal one is very simple. I have provided some sample source under BeanInfo. It theory, you can have a bean without a BeanInfo, but it best to write one, even if just to provide an
JavaBeans have a persistence mechanism similar to serialization, but uses a fluffy
XML (extensible Markup Language) format and the PersistenceDelegate class.
Many companies are selling JavaBeans you can plug into your own custom
applications. I have some I have written available free with source code. They handle
prompting, data validation and generating error messages for data keyed. There are
plain and dbaware components for dates, FormattedTextFields, phone numbers,
provinces, postal codes, etc. you can download.
Book referral for Mastering JavaBeans
||recommend book⇒Mastering JavaBeans|
|800-pages. Now out of print.|
|Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.|
Oracle’s Javadoc on PersistenceDelegate
class : available: