Bean Customizer in Java

Bean Customizer in Java
Bean Customizer in Java

Bean Customizer in Java:

If a class wants to customize a java bean , then it must implement Customizer interface . The class always has to be a subclass of java.awt.Component. It must define all the methods of the Customizer interface.
The class should have no argument constructor . This enables an application builder to invoke the same.
It is useful when we allow an user to easily configure the bean.(Configuration is like providing simply properties like keys and values).
The customizer class if present inside a java Bean,we need to associate it via BeanDescriptor object which it turn returned by BenaInfo class.

The interface of the Customizer is given as below:


public abstract interface java.bean.Customizer {
//Methods
public abstract void addPropertyChangeListener(PropertyChangeListener listener);
//this method is used to register PropertyChangedListener object.
public abstract void removePropertyChangeListener(PropertyChangeListener listener);
//this method is used to de-register PropertyChangedListener object.
public abstract void setObject(Object bean);
//If the Customizer class is created by none but the coder of the same bean class,
//it needs to be instantiated and used by application builder.Once it is instantiated,
// we need to call setObject() method to specify the bean object.
}
 

Ads code goes here

Share and Enjoy !

READ  What Is Casting Upcasting and Downcasting in Java?

Leave a Comment

Your email address will not be published. Required fields are marked *