As we've seen, beanbox programs may rely on introspection of a bean to determine the list of properties, events, and methods it supports. In order for this to work, bean developers must follow a set of standard naming conventions, sometimes referred to as JavaBeans "design patterns." These patterns specify, for example, that the getter and setter accessor methods for a property should begin with get and set. Not all of the patterns are absolute requirements. If a bean has accessor methods with different names, it is possible to use a PropertyDescriptor object, specified in a BeanInfo class, to specify the accessor methods for the property. Note, however, that although an accessor method name is not required to follow the pattern, the method is required to have the exact type signature specified by the pattern.
This section lists the design patterns for bean properties, events, and methods. It also lists other conventions and requirements that you should keep in mind when developing beans.
Any
Any
Must have a no-argument constructor, or a serialized template file
JAR file manifest entry specifies Java-Bean: True
public T getP()
public void setP(T value)
public boolean getP()
or public boolean is P() setter:
public void setP
public T[] getP()
public void setP(T[] value)
public T getP(int index)
public void setP(int index, T value)
Same as regular property
Same as regular property
One event listener list for all bound properties of a bean
public void addPropertyChangeListener (PropertyChangeListener l)
public void removePropertyChangeListener (PropertyChangeListener l)
Same as regular property
public void setP(T value) throws PropertyVetoException
One event listener list for all constrained properties of a bean
public void addVetoableChangeListener (VetoableChangeListener l)
public void removeVetoableChangeListener (VetoableChangeListener l)
EEvent
EListener
public void methodname(EEvent e)
public void addEListener(EListener l)
public void removeEListener(EListener l)
public void addEListener(EListener l) throws TooManyListenersException
public void removeEListener(EListener l)
Any
Any; some tools only recognize no-argument methods
BBeanInfo
TEditor
Must have a no-argument constructor
Any; register via PropertyDescriptor
Must have a no-argument constructor
Any; register via BeanDescriptor (BCustomizer by convention)
Must be a component; typically extends Panel
Must have a no-argument constructor
B.html
locale/B.html