org.springframework.beans
Class ExtendedBeanInfo

java.lang.Object
  extended by org.springframework.beans.ExtendedBeanInfo
All Implemented Interfaces:
java.beans.BeanInfo

 class ExtendedBeanInfo
extends java.lang.Object
implements java.beans.BeanInfo

Decorates a standard BeanInfo object (likely created created by Introspector.getBeanInfo(Class)) by including non-void returning setter methods in the collection of property descriptors. Both regular and indexed properties are fully supported.

The wrapped BeanInfo object is not modified in any way.

Since:
3.1
Author:
Chris Beams
See Also:
CachedIntrospectionResults

Nested Class Summary
(package private) static class ExtendedBeanInfo.PropertyDescriptorComparator
          Sorts PropertyDescriptor instances alphanumerically to emulate the behavior of BeanInfo.getPropertyDescriptors().
 
Field Summary
private  java.beans.BeanInfo delegate
           
private  Log logger
           
private  java.util.SortedSet<java.beans.PropertyDescriptor> propertyDescriptors
           
 
Fields inherited from interface java.beans.BeanInfo
ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, ICON_MONO_32x32
 
Constructor Summary
ExtendedBeanInfo(java.beans.BeanInfo delegate)
          Wrap the given delegate BeanInfo instance and find any non-void returning setter methods, creating and adding a PropertyDescriptor for each.
 
Method Summary
private  void addOrUpdatePropertyDescriptor(java.beans.PropertyDescriptor pd, java.lang.String propertyName, java.lang.reflect.Method readMethod, java.lang.reflect.Method writeMethod)
           
private  void addOrUpdatePropertyDescriptor(java.beans.PropertyDescriptor pd, java.lang.String propertyName, java.lang.reflect.Method readMethod, java.lang.reflect.Method writeMethod, java.lang.reflect.Method indexedReadMethod, java.lang.reflect.Method indexedWriteMethod)
           
 java.beans.BeanInfo[] getAdditionalBeanInfo()
           
 java.beans.BeanDescriptor getBeanDescriptor()
           
 int getDefaultEventIndex()
           
 int getDefaultPropertyIndex()
           
 java.beans.EventSetDescriptor[] getEventSetDescriptors()
           
 java.awt.Image getIcon(int arg0)
           
 java.beans.MethodDescriptor[] getMethodDescriptors()
           
 java.beans.PropertyDescriptor[] getPropertyDescriptors()
          Return the set of PropertyDescriptors from the wrapped BeanInfo object as well as PropertyDescriptors for each non-void returning setter method found during construction.
private  java.lang.Object getterMethodNameFor(java.lang.String name)
           
private  java.lang.String propertyNameFor(java.lang.reflect.Method method)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private final Log logger

delegate

private final java.beans.BeanInfo delegate

propertyDescriptors

private final java.util.SortedSet<java.beans.PropertyDescriptor> propertyDescriptors
Constructor Detail

ExtendedBeanInfo

public ExtendedBeanInfo(java.beans.BeanInfo delegate)
                 throws java.beans.IntrospectionException
Wrap the given delegate BeanInfo instance and find any non-void returning setter methods, creating and adding a PropertyDescriptor for each.

Note that the wrapped BeanInfo is modified by this process.

Throws:
java.beans.IntrospectionException - if any problems occur creating and adding new PropertyDescriptors
See Also:
getPropertyDescriptors()
Method Detail

addOrUpdatePropertyDescriptor

private void addOrUpdatePropertyDescriptor(java.beans.PropertyDescriptor pd,
                                           java.lang.String propertyName,
                                           java.lang.reflect.Method readMethod,
                                           java.lang.reflect.Method writeMethod)
                                    throws java.beans.IntrospectionException
Throws:
java.beans.IntrospectionException

addOrUpdatePropertyDescriptor

private void addOrUpdatePropertyDescriptor(java.beans.PropertyDescriptor pd,
                                           java.lang.String propertyName,
                                           java.lang.reflect.Method readMethod,
                                           java.lang.reflect.Method writeMethod,
                                           java.lang.reflect.Method indexedReadMethod,
                                           java.lang.reflect.Method indexedWriteMethod)
                                    throws java.beans.IntrospectionException
Throws:
java.beans.IntrospectionException

propertyNameFor

private java.lang.String propertyNameFor(java.lang.reflect.Method method)

getterMethodNameFor

private java.lang.Object getterMethodNameFor(java.lang.String name)

getAdditionalBeanInfo

public java.beans.BeanInfo[] getAdditionalBeanInfo()
Specified by:
getAdditionalBeanInfo in interface java.beans.BeanInfo

getBeanDescriptor

public java.beans.BeanDescriptor getBeanDescriptor()
Specified by:
getBeanDescriptor in interface java.beans.BeanInfo

getDefaultEventIndex

public int getDefaultEventIndex()
Specified by:
getDefaultEventIndex in interface java.beans.BeanInfo

getDefaultPropertyIndex

public int getDefaultPropertyIndex()
Specified by:
getDefaultPropertyIndex in interface java.beans.BeanInfo

getEventSetDescriptors

public java.beans.EventSetDescriptor[] getEventSetDescriptors()
Specified by:
getEventSetDescriptors in interface java.beans.BeanInfo

getIcon

public java.awt.Image getIcon(int arg0)
Specified by:
getIcon in interface java.beans.BeanInfo

getMethodDescriptors

public java.beans.MethodDescriptor[] getMethodDescriptors()
Specified by:
getMethodDescriptors in interface java.beans.BeanInfo

getPropertyDescriptors

public java.beans.PropertyDescriptor[] getPropertyDescriptors()
Return the set of PropertyDescriptors from the wrapped BeanInfo object as well as PropertyDescriptors for each non-void returning setter method found during construction.

Specified by:
getPropertyDescriptors in interface java.beans.BeanInfo
See Also:
ExtendedBeanInfo(BeanInfo)