Why javabeans framework create the IndexedPropertyDescriptor for the NON index method
- by George Macus
I'm not familiar with java beans framework, in the below scenario, I got the IndexedPropertyDescriptor for the method getFooWithX, could someone explain why?
public class IntrospectorTest {
public static void main(String[] args) throws IntrospectionException {
BeanInfo info = Introspector.getBeanInfo(SubClass.class);
PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
for (int i = 0; i < descriptors.length; i++) {
System.out.println(descriptors[i].getClass().getName() + ":" + descriptors[i].getName());
}
}
}
abstract class BaseClass {
public abstract Object getFoo();
}
abstract class SubClass extends BaseClass {
public Object getFooWithX(int x) {
return null;
}
}
and the result will be:
java.beans.PropertyDescriptor:class
java.beans.PropertyDescriptor:foo
java.beans.IndexedPropertyDescriptor:fooWithX
Why?