Introduction to Java Beans Internals

This module takes you inside a Bean to learn about the structure and organization of data and methods,
the two primary parts of a Bean.
You learn all about properties, which model the public portion of a Bean's data and are accessible externally through accessor methods.
You take a look at the different types of properties, including simple properties, indexed properties, bound properties, and constrained properties.
Toward the end of the module you work through a practical exercise of creating a property and its associated accessor methods.

Module learning objectives

After completing this module, you will have the knowledge and skills necessary to:

Design and code properties for your own Beans

Define accessor methods used to access properties

Understand when and why to use indexed, bound, and constrained properties

In the next lesson, the structural makeup of a Bean will be discused.

The JavaBeans architecture is supposed to scale well from small to large; simple beans can be used to build larger beans.
A small bean may consist of a single class; a large bean may have many. Beans can also work together through their container to provide services to other beans.
Simple beans are little more than ordinary Java objects.

In fact, any Java class that has a default (empty) constructor could be considered a bean.

A bean should also be serializable, although the JavaBeans specification doesn’t strictly require that.

These two criteria ensure that we can create an instance of the bean dynamically and that we can later save the bean as part of a group or composition of beans.
There are no other requirements. Beans are not required to inherit from a base bean class, and they do not have to implement any special interface.
A useful bean should send and receive events and expose its properties to the world.
To do so, it follows the appropriate design patterns for naming the relevant methods so that these features can be automatically discovered.
Most nontrivial beans intended for use in a visual application builder IDE also provide information about themselves in the form of a BeanInfo class.
A BeanInfo class implements the BeanInfo interface, which holds methods that describe a bean’s features in more detail,
along with extra packaging, such as icons for display to the user.
Normally, this “bean info” is supplied by a separate class that is named for and supplied with the bean.