[jboss-dev-forums] [Design of JBossXB] - Re: JBossXB-2.0.0.CR5
scott.stark@jboss.org
do-not-reply at jboss.com
Mon Sep 24 22:52:59 EDT 2007
The problem is this section of code for collections. The annotation property is a collection, and there is no XmlType annotation, so this gets executed:
| // a collection may be bound as a value of a complex type
| // and this is checked with the XmlType annotation
| else if (propertyType.isCollection() && ((ClassInfo) propertyType).getUnderlyingAnnotation(XmlType.class) == null)
| {
| isCol = true;
| propertyHandler = new CollectionPropertyHandler(property, propertyType);
| ClassInfo typeArg = (ClassInfo) findComponentType(property);
|
| //if (((ClassInfo) typeArg).getUnderlyingAnnotation(XmlType.class) != null)
| if (typeArg != null && typeArg.getUnderlyingAnnotation(JBossXmlModelGroup.class) == null)
| {// it may be a model group in which case we don't want to change the type
|
| // TODO yes, this is another hack with collections
| JBossXmlChild xmlChild = ((ClassInfo) propertyType).getUnderlyingAnnotation(JBossXmlChild.class);
| if (xmlChild == null)
| {
| localPropertyType = typeArg;
| }
| }
| }
|
This ends up overriding the localPropertyType (that has been correctly set previously from the XmlElement) to the interface class. The typeArg is a collection of the interface class when it should be a collection of the overriden localPropertyType.
I guess the findComponentType(property) call needs to take the localPropertyType as well as the CollectionPropertyHandler ctor.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088237#4088237
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088237
More information about the jboss-dev-forums
mailing list