I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example:
public interface Person {
String getName();
}
public interface Employee extends Person {
int getSalary();
}
Introspecting on Employee only yields salary even though name is inherited from Person.
Why is this? I would rather not have to use reflection to get all the getters.
This issue is covered in Sun bug java.beans.Introspector doesn't work for interfaces
The Java VM does not support this out of the box as Phil wrote. I also needed this and implemented a helper class as part of Diergo Utils 1.5.
Try using
public static BeanInfo getBeanInfo(Class<?> beanClass, Introspector.USE_ALL_BEANINFO);
and see if this yields the result you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With