[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: TypeInfo.newArrayInstance problems
alesj
do-not-reply at jboss.com
Fri Oct 12 11:00:27 EDT 2007
"adrian at jboss.org" wrote :
| char[] is an Object even if it isn't an Object[]
|
Yup, thought of that. ;-)
But this sucks, since then you don't know what to do when you have something like this:
| Object[] array;
| try
| {
| array = type.newArrayInstance(arrayValue.getLength());
| }
| catch (Throwable t)
| {
| throw new UndeclaredThrowableException(t);
| }
| for (int j = 0; j < array.length; j++)
| {
| Object element = arrayValue.getValue(i);
| if (element instanceof MetaValue)
| {
| TypeInfo elementType = configuration.getTypeInfo(element.getClass());
| element = unwrap((MetaValue)element, elementType);
| }
| array[j] = element;
| }
|
How to assign element to array if it were plain Object? :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094642#4094642
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094642
More information about the jboss-dev-forums
mailing list