[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Using a CompositeMetaType for a Map with String keys?
scott.stark@jboss.org
do-not-reply at jboss.com
Wed Mar 5 14:57:01 EST 2008
I update the DefaultMetaTypeFactory.generate(TypeInfo typeInfo) handling of map types to create a MapCompositeMetaType for String,? parameterized maps:
| if (typeInfo.isMap())
| {
| // See if this is a Map<String,?> type
| ClassInfo classInfo = (ClassInfo) typeInfo;
| TypeInfo[] types = classInfo.getActualTypeArguments();
| if (types != null)
| {
| TypeInfo keyType = types[0];
| TypeInfo valueType = types[1];
| if(keyType.getName().equals(String.class.getName()))
| {
| // Use MapCompositeMetaType
| MetaType valueMetaType = resolve(valueType);
| return new MapCompositeMetaType(valueMetaType);
| }
| }
| // No, return the general map type
| return generateMap(classInfo);
| }
|
but the following 4 tests fail because they all use types that fall into the Map(String, ?) pattern, and they are expecting TableMetaType/TableValues:
| Failed tests:
| testSimpleMap(org.jboss.test.metatype.values.factory.test.MapValueFactoryUnitT
| estCase)
| testCompositeValueMap(org.jboss.test.metatype.values.factory.test.MapValueFact
| oryUnitTestCase)
| testSimpleMap(org.jboss.test.metatype.types.factory.test.MapMetaTypeFactoryUni
| tTestCase)
| testCompositeValueMap(org.jboss.test.metatype.types.factory.test.MapMetaTypeFa
| ctoryUnitTestCase)
|
What do we want to change, tests or how the factory gets configured for MapCompositeMetaType?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134388#4134388
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134388
More information about the jboss-dev-forums
mailing list