Java Beans are not required to inherit from any particular base class or interface although visible beans must inherit from java.awt.Component. The three most important features of a bean class are:
setXXX()/getXXX() methods.
Bean programmers can explicitly provide an implementation of a
BeanInfo class which describes the structure of a bean. That is, the
BeanInfo class has methods,
getEventDescrips()/getMethodDescrips()/... which return arrays
of EventDescriptors, MethodDescriptors, etc. A PropertyDescriptor, for
example, has methods which return the Method objects
corresponding to the get
and set methods of that property of the bean class.
By default, bean programmers do not have to provide BeanInfo classes, however.
Instead, reflection is used to generate a BeanInfo class for a
given bean. Reflection does things like looking at the fields of the
bean classes to obtain a list of properties and then looking for the
getXXX()/setXXX() methods, which it takes to be the get and set
accessor methods of the property. There are a set of syntactic rules
(called ``Design Patterns'' in the beans spec.)
which are used to extract the features of the bean class. For
example, if a java.awt.Color color field is found in the class,
representing a ``color'' property, then there should also be
public java.awt.Color getColor() and
public void setColor(Color c) methods in the class.
Java beans are indeed useful to application programmers and the Reflection API is crucial in order for the entire JavaBeans API to be 100% pure Java (platform independence being one of the main goals of JavaBeans).