"alesj" wrote : "scott.stark(a)jboss.org" wrote : We should be
restrictive on the type so if the setter is more specific use that.
| Any general rules on what is more restrictive?
| Or how to write AbstractBeanInfoFactory.getPropertyType()? ;-)
It has to be some compiler problem solution. It seems you have to have a type tree for the
non-parameterized type and find the most derived type, and then the most derived
parameterized type. For these two examples of property accessors, List would be determined
for both.
| public List getBeans()
| {
| return beans;
| }
|
| public void setBeans(Iterable<SimpleBean> beans)
| {
| this.beans = beans;
| }
|
| public Iterable<SimpleBean> getBeans()
| {
| return beans;
| }
|
| public void setBeans(List beans)
| {
| this.beans = beans;
| }
|
| public Iterable<SimpleBean> getBeans()
| {
| return beans;
| }
|
| public void setBeans(List beans)
| {
| this.beans = beans;
| }
|
It gets more complicated if a concrete type vs an interface is used though, as in this
crazy example:
| public Iterable<SimpleBean> getBeans()
| {
| return beans;
| }
|
| public void setBeans(javax.management.AttributeList beans)
| {
| this.beans = beans;
| }
|
where AttributeList is a non-parameterized List with overloaded methods for adding/setting
elements of type javax.management.Attribute, a non-interface type. If SimpleBean is a
class its impossible to reconcile all expected uses. Its possible if SimpleBean is an
interface, but that is a crazy type graph to figure out.
I guess the main question is how much trouble do we want to go to at this point? What does
the java.beans.Introspector return for the BeanInfo.PropertyDescriptor for such examples?
Does it match up these as the same property with a common type, or does it see these as
the same property with different accessors, or a conflict?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4072685#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...