Java BeanUtils - Customizing Introspection


Advertisements


Description

The introspection tool can be used to learn about the properties and operations provided by your class. BeanUtils package is depending on JavaBeans specification that determines the available properties for a particular bean class.

The introspection mechanism can be customized from version 1.9.0 onwards and enables an application to alter or extend the default discovery of bean properties. You can achieve this by using the BeanIntrospector interface. By implementing this interface, we are able to process a specific target class and create its equivalent PropertyDescriptor objects. By default, DefaultBeanIntrospector objects are used by BeanUtils for detecting properties that are matching with the JavaBeans specification.

You can extend the default discovery mechanism by using the PropertyUtils.addBeanIntrospector(BeanIntrospector) method of PropertyUtils. This custom BeanIntrospector can be called in the time of introspection of a class and adds the detected properties to the final result.



Advertisements
E-Books Store