Top Description Inners Fields Constructors Methods
org.springframework.beans

pack-priv Class ExtendedBeanInfo

extends Object
implements BeanInfo
Class Inheritance
All Implemented Interfaces
java.beans.BeanInfo
Imports
java.awt.Image, java.beans.BeanDescriptor, .BeanInfo, .EventSetDescriptor, .IndexedPropertyDescriptor, .IntrospectionException, .Introspector, .MethodDescriptor, .PropertyDescriptor, java.lang.reflect.Method, .Modifier, java.util.ArrayList, .Comparator, .List, .Objects, .Set, .TreeSet, org.apache.commons.logging.Log, .LogFactory, org.springframework.lang.Nullable, org.springframework.util.ObjectUtils

Decorator for a standard BeanInfo object, e.g. as created by Introspector#getBeanInfo(Class), designed to discover and register static and/or non-void returning setter methods. For example:
public class Bean {

    private Foo foo;

    public Foo getFoo() {
        return this.foo;
    }

    public Bean setFoo(Foo foo) {
        this.foo = foo;
        return this;
    }
}
The standard JavaBeans Introspector will discover the getFoo read method, but will bypass the #setFoo(Foo) write method, because its non-void returning signature does not comply with the JavaBeans specification. ExtendedBeanInfo, on the other hand, will recognize and include it. This is designed to allow APIs with "builder" or method-chaining style setter signatures to be used within Spring <beans> XML. getPropertyDescriptors() returns all existing property descriptors from the wrapped BeanInfo as well any added for non-void returning setters. Both standard ("non-indexed") and indexed properties are fully supported.
Authors
Chris Beams, Juergen Hoeller
Since
3.1
See Also
ExtendedBeanInfo(BeanInfo), ExtendedBeanInfoFactory, CachedIntrospectionResults

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ExtendedBeanInfo.PropertyDescriptorComparator

Sorts PropertyDescriptor instances alpha-numerically to emulate the behavior of java.beans.BeanInfo#getPropertyDescriptors().

pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final BeanInfo
private static final Log
private final Set<PropertyDescriptor>

Constructor Summary

AccessConstructor and Description
public
ExtendedBeanInfo(BeanInfo
the wrapped BeanInfo, which is never modified
delegate
)

Wrap the given BeanInfo instance; copy all its existing property descriptors locally, wrapping each in a custom indexed or non-indexed PropertyDescriptor variant that bypasses default JDK weak/soft reference management; then search through its method descriptors to find any non-void returning write methods and update or create the corresponding PropertyDescriptor for each one found.

Method Summary

Modifier and TypeMethod and Description
private List<Method>
private PropertyDescriptor
findExistingPropertyDescriptor(String propertyName, Class<?> propertyType)

public BeanInfo[]
getAdditionalBeanInfo()

Implements java.beans.BeanInfo.getAdditionalBeanInfo.

This method enables the current BeanInfo object to return an arbitrary collection of other BeanInfo objects that provide additional information about the current bean.

public BeanDescriptor
getBeanDescriptor()

Implements java.beans.BeanInfo.getBeanDescriptor.

Returns the bean descriptor that provides overall information about the bean, such as its display name or its customizer.

public int
getDefaultEventIndex()

Implements java.beans.BeanInfo.getDefaultEventIndex.

A bean may have a default event typically applied when this bean is used.

public int
getDefaultPropertyIndex()

Implements java.beans.BeanInfo.getDefaultPropertyIndex.

A bean may have a default property commonly updated when this bean is customized.

public EventSetDescriptor[]
getEventSetDescriptors()

Implements java.beans.BeanInfo.getEventSetDescriptors.

Returns the event descriptors of the bean that define the types of events fired by this bean.

public Image
getIcon(int
the kind of icon requested
iconKind
)

Implements java.beans.BeanInfo.getIcon.

Returns an image that can be used to represent the bean in toolboxes or toolbars.

public MethodDescriptor[]
getMethodDescriptors()

Implements java.beans.BeanInfo.getMethodDescriptors.

Returns the method descriptors of the bean that define the externally visible methods supported by this bean.

public PropertyDescriptor[]
getPropertyDescriptors()

Implements java.beans.BeanInfo.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 void
public static boolean
private String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait