public class DefaultBeanIntrospector extends java.lang.Object implements BeanIntrospector
The default BeanIntrospector implementation.
This class implements a default bean introspection algorithm based on the JDK
classes in the java.beans package. It discovers properties
conforming to the Java Beans specification.
This class is a singleton. The single instance can be obtained using the
INSTANCE field. It does not define any state and thus can be
shared by arbitrary clients. PropertyUtils per default uses this
instance as its only BeanIntrospector object.
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.Class<?>[] |
EMPTY_CLASS_PARAMETERS
Constant for argument types of a method that expects no arguments.
|
static BeanIntrospector |
INSTANCE
The singleton instance of this class.
|
private static java.lang.Class<?>[] |
LIST_CLASS_PARAMETER
Constant for arguments types of a method that expects a list argument.
|
private org.apache.commons.logging.Log |
log
Log instance
|
| Modifier | Constructor and Description |
|---|---|
private |
DefaultBeanIntrospector()
Private constructor so that no instances can be created.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
handleIndexedPropertyDescriptors(java.lang.Class<?> beanClass,
java.beans.PropertyDescriptor[] descriptors)
This method fixes an issue where IndexedPropertyDescriptor behaves
differently in different versions of the JDK for 'indexed' properties
which use java.util.List (rather than an array).
|
void |
introspect(IntrospectionContext icontext)
Performs introspection of a specific Java class.
|
public static final BeanIntrospector INSTANCE
private static final java.lang.Class<?>[] EMPTY_CLASS_PARAMETERS
private static final java.lang.Class<?>[] LIST_CLASS_PARAMETER
private final org.apache.commons.logging.Log log
private DefaultBeanIntrospector()
public void introspect(IntrospectionContext icontext)
java.beans.Introspector.getBeanInfo() method to obtain
all property descriptors for the current class and adds them to the
passed in introspection context.introspect in interface BeanIntrospectoricontext - the introspection contextprivate void handleIndexedPropertyDescriptors(java.lang.Class<?> beanClass,
java.beans.PropertyDescriptor[] descriptors)
public List getFoo() public Object getFoo(int index) public void setFoo(List foo) public void setFoo(int index, Object foo)then the IndexedPropertyDescriptor's getReadMethod() and getWriteMethod() behave as follows:
beanClass - the current class to be inspecteddescriptors - the array with property descriptors