Why javabeans framework create the IndexedPropertyDescriptor for the NON index method
Posted
by
George Macus
on Stack Overflow
See other posts from Stack Overflow
or by George Macus
Published on 2012-08-31T03:36:08Z
Indexed on
2012/08/31
3:38 UTC
Read the original article
Hit count: 130
javabeans
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?
© Stack Overflow or respective owner