[jboss-dev-forums] [Design of JBossXB] - Using generics info in CollectionPropertyHandler
alesj
do-not-reply at jboss.com
Fri Nov 21 18:28:35 EST 2008
Checking how KernelDeployment handles BeanMetaDataFactorys I came with the following issue:
- http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191432#4191432
I guess CollectionPropertyHandler could include this check
| if (child != null)
| {
| TypeInfo typeInfo = propertyInfo.getType();
| if (typeInfo instanceof ClassInfo)
| {
| ClassInfo classInfo = (ClassInfo)typeInfo;
| TypeInfo componentType = classInfo.getComponentType();
| if (componentType != null)
| {
| TypeInfoFactory tif = componentType.getTypeInfoFactory();
| TypeInfo childTypeInfo = tif.getTypeInfo(child.getClass());
| if (componentType.isAssignableFrom(childTypeInfo) == false)
| throw new IllegalArgumentException("Illegal child type");
| }
| }
| }
|
probably in a bit more optimized way - not checking for component type every time.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191434#4191434
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191434
More information about the jboss-dev-forums
mailing list