You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Brian Murray <br...@gmail.com> on 2006/09/28 20:18:45 UTC

Mixed content and isMany()

If a DataObject has mixed content, DataObject.getInstanceProperties() will
include a Property for the Sequence that accounts for that mixed content.  I
have verified (on page 87 of the spec) that this is the expected behavior.

Should the Property representing that particular Sequence return isMany() ==
true?

The problem I have is that I had wanted to perform the following check:

        currentProperty = (Property) properties.get(i);
        if (currentProperty.isMany())
        {
            List values =  dataObject.getList(i);

However, in the case where currentProperty is the "mixed" this will result
in a ClassCastException because org.apache.tuscany.sdo.util.BasicSequence is
incompatible with java.util.List.  The exception is thrown in
DataObjectUtil.getList when the cast to List is attempted.

Is it true then that isMany() == true is insufficient to assume that you
will be able to call getList()?

Re: Mixed content and isMany()

Posted by Frank Budinsky <fr...@ca.ibm.com>.
isMany() == true should be sufficient checking before calling getList(). 
This problem will be fixed by TUSCANY-521.

Frank.

"Brian Murray" <br...@gmail.com> wrote on 09/28/2006 02:18:45 
PM:

> If a DataObject has mixed content, DataObject.getInstanceProperties() 
will
> include a Property for the Sequence that accounts for that mixed 
content.  I
> have verified (on page 87 of the spec) that this is the expected 
behavior.
> 
> Should the Property representing that particular Sequence return 
isMany() ==
> true?
> 
> The problem I have is that I had wanted to perform the following check:
> 
>         currentProperty = (Property) properties.get(i);
>         if (currentProperty.isMany())
>         {
>             List values =  dataObject.getList(i);
> 
> However, in the case where currentProperty is the "mixed" this will 
result
> in a ClassCastException because 
org.apache.tuscany.sdo.util.BasicSequence is
> incompatible with java.util.List.  The exception is thrown in
> DataObjectUtil.getList when the cast to List is attempted.
> 
> Is it true then that isMany() == true is insufficient to assume that you
> will be able to call getList()?


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org