[jboss-dev-forums] [Design of JBossXB] - Re: Collections with interfaces

scott.stark@jboss.org do-not-reply at jboss.com
Sun Oct 21 23:23:31 EDT 2007


This is due to this code block not checking the localPropertyType for 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.equals(propertyType))
  |                      { // the localPropertyType was not overriden previously so use the collection parameter type
  |                         localPropertyType = typeArg;
  |                      }
  |                   }
  |                }
  | 

when the property type is a parameterized interface, the localPropertyType refers to the real type that carries the annotation information. Changing the check to be:


  |                else if (propertyType.isCollection() && ((ClassInfo) localPropertyType).getUnderlyingAnnotation(XmlType.class) == null)
  |                {
  | 
gets the parsing to occur as I expect. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097301#4097301

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097301



More information about the jboss-dev-forums mailing list