class BeanIntrospectionData
extends java.lang.Object
An internally used helper class for storing introspection information about a bean class.
This class is used by PropertyUtilsBean
. When accessing bean properties via
reflection information about the properties available and their types and access
methods must be present. PropertyUtilsBean
stores this information in a cache
so that it can be accessed quickly. The cache stores instances of this class.
This class mainly stores information about the properties of a bean class. Per default,
this is contained in PropertyDescriptor
objects. Some additional information
required by the BeanUtils
library is also stored here.
Modifier and Type | Field and Description |
---|---|
private java.beans.PropertyDescriptor[] |
descriptors
An array with property descriptors for the managed bean class.
|
private java.util.Map<java.lang.String,java.lang.String> |
writeMethodNames
A map for remembering the write method names for properties.
|
Constructor and Description |
---|
BeanIntrospectionData(java.beans.PropertyDescriptor[] descs)
Creates a new instance of
BeanIntrospectionData and initializes its
completely. |
BeanIntrospectionData(java.beans.PropertyDescriptor[] descs,
java.util.Map<java.lang.String,java.lang.String> writeMethNames)
Creates a new instance of
BeanIntrospectionData and allows setting the map
with write method names. |
Modifier and Type | Method and Description |
---|---|
java.beans.PropertyDescriptor |
getDescriptor(java.lang.String name)
Returns the
PropertyDescriptor for the property with the specified name. |
java.beans.PropertyDescriptor[] |
getDescriptors()
Returns the array with property descriptors.
|
java.lang.reflect.Method |
getWriteMethod(java.lang.Class<?> beanCls,
java.beans.PropertyDescriptor desc)
Returns the write method for the property determined by the given
PropertyDescriptor . |
private static java.util.Map<java.lang.String,java.lang.String> |
setUpWriteMethodNames(java.beans.PropertyDescriptor[] descs)
Initializes the map with the names of the write methods for the supported
properties.
|
private final java.beans.PropertyDescriptor[] descriptors
private final java.util.Map<java.lang.String,java.lang.String> writeMethodNames
public BeanIntrospectionData(java.beans.PropertyDescriptor[] descs)
BeanIntrospectionData
and initializes its
completely.descs
- the array with the descriptors of the available propertiesBeanIntrospectionData(java.beans.PropertyDescriptor[] descs, java.util.Map<java.lang.String,java.lang.String> writeMethNames)
BeanIntrospectionData
and allows setting the map
with write method names. This constructor is mainly used for testing purposes.descs
- the array with the descriptors of the available propertieswriteMethNames
- the map with the names of write methodspublic java.beans.PropertyDescriptor[] getDescriptors()
public java.beans.PropertyDescriptor getDescriptor(java.lang.String name)
PropertyDescriptor
for the property with the specified name. If
this property is unknown, result is null.name
- the name of the property in questionPropertyDescriptor
for this property or nullpublic java.lang.reflect.Method getWriteMethod(java.lang.Class<?> beanCls, java.beans.PropertyDescriptor desc)
PropertyDescriptor
. This information is normally available in the
descriptor object itself. However, at least by the ORACLE implementation, the
method is stored as a SoftReference
. If this reference has been freed by
the GC, it may be the case that the method cannot be obtained again. Then,
additional information stored in this object is necessary to obtain the method
again.beanCls
- the class of the affected beandesc
- the PropertyDescriptor
of the desired propertyprivate static java.util.Map<java.lang.String,java.lang.String> setUpWriteMethodNames(java.beans.PropertyDescriptor[] descs)
PropertyDescriptor
objects.descs
- the array with the descriptors of the available propertiesCopyright (c) 2000-2008 - Apache Software Foundation