On Mon, 2007-07-30 at 14:39 +0200, Alexey Loubyansky wrote:
Adrian wrote:
> Perhaps we can add that to the ClassInfo model?
That would be excellent.
> if (classInfo.isCollection())
> typeInfo = classInfo.getComponentType();
>
> and it would do all the hard work of locating the collection
> definition and retrieving the type.
>
> We could also do something similar for maps, i.e.
>
> if (classInfo.isMap())
> {
> keyType = classInfo.getKeyType();
> valueType = classInfo.getValueType();
> }
This one too!
I've implemented this. It was actually easier
than I thought once I got my head around it. :-)
See the bottom of IntrospectionTypeInfoFactoryImpl
The basic idea is to locate the Collection interface
in the type hierarchy
then work your way back mapping TypeVariables
until you reach where the real type is specified.
Or failing that use the upper bounds of the
last TypeVariable found.
Thanks,
Alexey
_______________________________________________
jboss-development mailing list
jboss-development(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-development --
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Adrian Brock
Chief Scientist
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx