Maybe the exception isn't from getList.
For class casting such as "(expectation)actualClassInstance",
the exception looks like "actualClass incompatible with expectation".
I guess the exception is from "(DataObject)value" such as getDataObject. So
in the mentioned sample:
1. DataObject items = purchaseOrder.getDataObject("items");
2. List itemList = items.getList("item");
the exception may come from line 1 instead of line 2.
On 1/29/07, Christian Landbo Frederiksen <
[EMAIL PROTECTED]> wrote:
It is Many:
The thing it that is was during an analysis of a schema and the 'Many'
property was not set in the DataObject.
When dealing with a not 'many' property the get-method just returns null
but when dealing with a 'many' property the getList resulted in the
mentioned ClassCastException.
Now I avoid it by checking for dataObject.isSet(p) before calling
getList.
/Chr
-----Original Message-----
From: Frank Budinsky [mailto:[EMAIL PROTECTED]
Sent: 29. januar 2007 22:48
To: [email protected]
Subject: Re: java.lang.ClassCastException
org.eclipse.emf.ecore.util.EcoreEList$Dynamicincompatible with
commonj.sdo.DataObject
I'm guessing that the property that your calling getList() for is single
valued. You can only call getList() on a property if the property has
Property.isMany == true. In other words, there's no automatic conversion
from a single valued property value to List.
Frank.
"Christian Landbo Frederiksen" <[EMAIL PROTECTED]>
wrote on 01/29/2007 03:24:42 PM:
> Hi
>
> I just ran into a classcast exception when I tried to call getList on
a
> dataobject.
>
> I searched a bit for it and found this in the samples:
>
> PurchaseOrderControl.removeItem(int index) {
> // TODO: this is not working due to
> java.lang.ClassCastException:
> // org.eclipse.emf.ecore.util.EcoreEList$Dynamic incompatible
> with commonj.sdo.DataObject
> // access a DataObject by the index and then remove it
>
>
> Can anybody tell more about this?
>
> /Chr
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Yang ZHONG