Java Beans API

Java Beans:

It is a software component that has been designed to be reusable in a variety of different environments. There is no restriction on the capability of a Bean. It may perform a simple function, such as obtaining an inventory value. A Bean may be visible to an end-user. A Bean may also be invisible to a user. The Java Beans functionality is provided by a set of classes and interfaces in the java.beans package.

Advantages of Java Beans:

1. A Bean obtains all the benefits of Java’s “write-once, run-anywhere” paradigm.

2. The properties, events, and methods of a Bean that are exposed to another application can be controlled.

3. Auxiliary software can be provided to help configure a Bean. This software is only needed when the design-time parameters for that component are being set.

4. The configuration settings of a Bean can be saved in persistent storage and restored at a later time.

5. A Bean may register to receive events from other objects and can generate events that are sent to other objects.

Java Beans Interface:

AppletInitializer: Methods in this interface are used to initialize Beans that are also applets.

BeanInfo: This interface allows a designer to specify information about the properties, events, and methods of a Bean.

Customizer: This interface allows a designer to provide a graphical user interface through which a Bean may be configured.

DesignMode: Methods in this interface determine if a Bean is executing in design mode.

ExceptionListener: A method in this interface is invoked when an exception has occurred.

PropertyChangeListener: A method in this interface is invoked when a bound property is changed.

PropertyEditor: Objects that implement this interface allow designers to change and display property values.

VetoableChangeListener: A method in this interface is invoked when a constrained property is changed.

Visibility: Methods in this interface allow a Bean to execute in environments where a graphical user interface is not available.

Java Beans Classes:

BeanDescriptor: This class provides information about a Bean. It also allows you to associate a customizer with a Bean.

Beans: This class is used to obtain information about a Bean.

DefaultPersistenceDelegate: A concrete subclass of PersistenceDelegate.

Encoder: Encodes the state of a set of Beans. Can be used to write this information to a stream.

EventHandler: Supports dynamic event listener creation.

EventSetDescriptor: Instances of this class describe an event that can be generated by a Bean.

Expression: Encapsulates a call to a method that returns a result.

FeatureDescriptor: This is the superclass of the PropertyDescriptor, EventSetDescriptor, and MethodDescriptor classes.

IndexedPropertyChangeEvent: A subclass of PropertyChangeEvent that represents a change to an indexed property.

IndexedPropertyDescriptor: Instances of this class describe an indexed property of a Bean.

IntrospectionException: An exception of this type is generated if a problem occurs when analyzing a Bean.

Introspector: This class analyzes a Bean and constructs a BeanInfo object that describes the component.

MethodDescriptor: Instances of this class describe a method of a Bean.

ParameterDescriptor: Instances of this class describe a method parameter.

PersistenceDelegate: Handles the state information of an object.

PropertyChangeEvent: This event is generated when bound or constrained properties are changed. It is sent to objects that registered an interest in these events and that implement either the PropertyChangeListener or VetoableChangeListener interfaces.

PropertyChangeListenerProxy: Extends EventListenerProxy and implements PropertyChangeListener.

PropertyChangeSupport: Beans that support bound properties can use this class to notify PropertyChangeListener objects.

PropertyDescriptor: Instances of this class describe the property of a Bean.

PropertyEditorManager: This class locates a PropertyEditor object for a given type.

PropertyEditorSupport: This class provides functionality that can be used when writing property editors.

PropertyVetoException: An exception of this type is generated if a change to a constrained property is vetoed.

SimpleBeanInfo: This class provides functionality that can be used when writing BeanInfo classes.

Statement: Encapsulates a call to a method.

VetoableChangeListenerProxy: Extends EventListenerProxy and implements VetoableChangeListener.

VetoableChangeSupport: Beans that support constrained properties can use this class to notify VetoableChangeListener objects.

XMLDecoder: It is used to read a Bean from an XML document.

XMLEncoder: It is used to write a Bean to an XML document.