StandardBeanInfo(Class<?> beanClass,
BeanInfo explicitBeanInfo,
Class<?> stopClass) throws IntrospectionException {
this.beanClass = beanClass;
/*--------------------------------------------------------------------------------------
* There are 3 aspects of BeanInfo that must be supplied:
* a) PropertyDescriptors
* b) MethodDescriptors
* c) EventSetDescriptors
* Each of these may be optionally provided in the explicitBeanInfo object relating to
* this bean. Where the explicitBeanInfo provides one of these aspects, it is used
* without question and no introspection of the beanClass is performed for that aspect.
* There are also 3 optional items of BeanInfo that may be provided by the
* explicitBeanInfo object:
* 1) BeanDescriptor
* 2) DefaultEventIndex
* 3) DefaultPropertyIndex
* These aspects of the beanClass cannot be derived through introspection of the class.
* If they are not provided by the explicitBeanInfo, then they must be left null in the
* returned BeanInfo, otherwise they will be copied from the explicitBeanInfo
--------------------------------------------------------------------------------------*/
if (explicitBeanInfo != null) {
this.explicitBeanInfo = explicitBeanInfo;
events = explicitBeanInfo.getEventSetDescriptors();
methods = explicitBeanInfo.getMethodDescriptors();
properties = explicitBeanInfo.getPropertyDescriptors();
defaultEventIndex = explicitBeanInfo.getDefaultEventIndex();
if (defaultEventIndex < 0 || defaultEventIndex >= events.length) {
defaultEventIndex = -1;
}
defaultPropertyIndex = explicitBeanInfo.getDefaultPropertyIndex();
if (defaultPropertyIndex < 0
|| defaultPropertyIndex >= properties.length) {
defaultPropertyIndex = -1;
}
additionalBeanInfo = explicitBeanInfo.getAdditionalBeanInfo();
for (int i = 0; i < 4; i++) {
icon[i] = explicitBeanInfo.getIcon(i + 1);
}
if (events != null)
explicitEvents = true;
if (methods != null)
explicitMethods = true;
if (properties != null)
explicitProperties = true;
}
if (methods == null) {
methods = introspectMethods();
}
if (properties == null) {
properties = introspectProperties(stopClass);
}
if (events == null) {
events = introspectEvents();
}
}
|