O'Reilly logo

JavaBeans Unleashed by Rick Leinecker, Dr. Donald Doherty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

When an Object's a Bean

A simple Java object becomes a Java bean when all of the object's data fields are private and are only accessible through methods, known as accessor methods. That's it! These requirements should be followed in object-oriented programming anyway. It's just that JavaBeans forces you to use proper object-oriented programming techniques.

There are also mutator methods, which change the values. The following example shows something that many of us have encountered:

Frame f = new Frame();
f.setVisible( true );
boolean visible = f.isVisible();

The incredibly simple migration from writing Java objects to writing Java beans is no accident. The JavaBeans component architecture is designed so that nearly all of the complexities ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required