![]() |
The Java Developers Almanac 1.4 |
|
e1. The Quintessential BeanThis example bean has a single property calledproperty. If the
property were not a boolean, it would not have an isX()
method. Also, if the property were read-only, it would not have a
setX() method.
import java.io.Serializable;
public class BasicBean implements Serializable {
boolean property;
public BasicBean() {
}
public boolean getProperty() {
return property;
}
public boolean isProperty() {
return property;
}
public void setProperty(boolean newValue) {
property = newValue;
}
}
e3. Implementing a Constrained Property e4. Instantiating a Bean e5. Listing the Property Names of a Bean e6. Getting and Setting a Property of a Bean
© 2002 Addison-Wesley. |