Bean Customizer in Java

0
154
Spread the love
  • 7
  • 6
  • 3
  • 3
  •  
  •  
  •  
  •  
  •  
  •  
    19
    Shares

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.
}
 
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 7
  • 6
  • 3
  • 3
  •  
  •  
  •  
  •  
  •  
  •  
    19
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here