Using Design Patterns
The JavaBeans architecture makes use of patterns that represent standard conventions for names, and type signatures for collections of methods and interfaces. Using coding standards is always a good idea because it makes your code easier to understand, and therefore easier to maintain. It also makes it easier for another programmer to understand the purpose of the methods and interfaces used by your component. In the JavaBeans architecture, these patterns have even more significance. A set of simple patterns are used by the default introspection mechanism to analyze your Bean and determine the properties, methods, and events that are supported. These patterns allow the visual development tools to analyze your Bean and use it in the application being created. The following code fragment shows one such pattern:
public void setTemperatureColor(Color newColor)
{
. . .
}
public Color getTemperatureColor()
{
. . .
}These two methods together use a pattern that signifies that the Bean
contains a property named TemperatureColor of
type Color. No extra development is required to
expose the property. The various patterns that apply to Beans
development will be pointed out and discussed throughout this book.
I’ll identify each pattern where the associated topic is being
discussed.
Note
The use of the term “design pattern” here may be confusing to some readers. This term is commonly used to describe the practice of documenting a reusable design in object-oriented software. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access