[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: setting managed property of type List

alesj do-not-reply at jboss.com
Fri Dec 7 11:36:33 EST 2007


Do we need a CollectionMetaType/Value?
Since this code doesn't know anything about the actual Collection class:

>From DefaultMetaValueFactory:

  |       else if (classInfo.isCollection())
  |       {
  |          Collection c = (Collection) value;
  |          oldArray = c.toArray();
  |       }
  |       else
  |          throw new UnsupportedOperationException("Cannot construct array for " + value.getClass());
  |       
  |       array = createArray(elementType, componentType.getComponentType(), dimension, oldArray);
  | 

And from DefaultMetaTypeFactory:

  |    /**
  |     * Generate a collection metatype
  |     * 
  |     * @param typeInfo the type info
  |     * @return the metatype
  |     */
  |    public ArrayMetaType generateCollection(ClassInfo typeInfo)
  |    {
  |       TypeInfo elementType = objectTypeInfo;
  |       
  |       TypeInfo[] types = typeInfo.getActualTypeArguments();
  |       if (types != null)
  |          elementType = types[0];
  |       
  |       MetaType elementMetaType = resolve(elementType);
  |       return new ArrayMetaType(1, elementMetaType);
  |    }
  | 

Hence no way of unwrapping it.

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

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



More information about the jboss-dev-forums mailing list