Guidelines: Identifying JavaBeans
Topics
Introduction

This guideline focuses on identifying and modeling JavaBeans.
For more information on JavaBeans, see Concepts: JavaBeans.
Identifying JavaBeans

JavaBeans are Java classes, which are written according to conventions of
the JavaBeans component model.
JavaBeans can be used in their simple form, where a JavaBean exposes properties
through its getters and setters, but fires no events. Such a JavaBean would
fall under the recommended practice of naming getters and setters for fields
of plain Java classes. This type of JavaBean is commonly used in Java Server
Pages, where it acts as a carrier of data from a form in a Web page.
An additional level of sophistication can be added if we want to allow other
parties to be notified upon change or attempt of change of a JavaBean property.
In this case, JavaBean needs to be designed so that it fires events describing
the change of the property.
JavaBeans which fire (and handle) events are common in user interface frameworks
such as Swing, where they are used to implement the Model-View-Controller architectural
pattern. JavaBeans representing the visual components often have additional
classes such as bean customizers, which allow for modification of JavaBean instances
during design time
Modeling JavaBeans

Java Beans are modeled as Java classes.
Properties of Java Beans are not explicitly modeled; instead, they are identified
through the JavaBeans naming conventions.

In design diagrams, it is helpful to use dependencies showing which class fires
or handles events. Event listeners are introduced as interfaces, which are realized
by their concrete implementations.

|