Home » Modeling » EMF » Defining ECore operations that return EList(problem with the returning type because EList is unmodificable)
Defining ECore operations that return EList [message #659673] |
Tue, 15 March 2011 08:21 |
Carlos Messages: 1 Registered: March 2011 |
Junior Member |
|
|
Hi.
I want to define an operation on a particular element of my ecore metamodel, and the returning type must be a list of elements.
In the ecore editor, I select EEList<?> as the returning type but my problem is that I can't create that kind of lists, neither make a cast from ArrayList to EList.
If I had to return eContents from an EObject, I have be able to return an EList, but in my case, I have to return a list of element built by me.
(At the moment, I have got a non smart solution based on not to declare the returning type in the ecore editor, and after that I set ArrayList<?> as the returnint type in the signature of the implemented method.
Please, have you got any suggestion in order to get something smarter?
Thanks in advance.
Regards.
Carlos.
|
|
|
Re: Defining ECore operations that return EList [message #659714 is a reply to message #659673] |
Tue, 15 March 2011 09:57 |
Eclipse User |
|
|
|
Originally posted by: koen.yskout.cs.kuleuven.be
Carlos,
You can set the EType to the type of the objects in the list, and set
the upper bound to -1.
Kind regards,
Koen
On 15/03/11 09:22, Carlos wrote:
> Hi.
>
> I want to define an operation on a particular element of my ecore
> metamodel, and the returning type must be a list of elements.
> In the ecore editor, I select EEList<?> as the returning type but my
> problem is that I can't create that kind of lists, neither make a cast
> from ArrayList to EList.
>
> If I had to return eContents from an EObject, I have be able to return
> an EList, but in my case, I have to return a list of element built by me.
>
> (At the moment, I have got a non smart solution based on not to declare
> the returning type in the ecore editor, and after that I set
> ArrayList<?> as the returnint type in the signature of the implemented
> method.
>
> Please, have you got any suggestion in order to get something smarter?
>
> Thanks in advance.
> Regards.
> Carlos.
|
|
| |
Re: Defining ECore operations that return EList [message #659750 is a reply to message #659714] |
Tue, 15 March 2011 13:45 |
Eclipse User |
|
|
|
Originally posted by: koen.yskout.cs.kuleuven.be
Hm, it looks like I completely misinterpreted your question :)
Using BasicEList, as Hallvard suggested, is probably the way to go.
On 15/03/11 10:57, Koen Yskout wrote:
> Carlos,
>
> You can set the EType to the type of the objects in the list, and set
> the upper bound to -1.
>
> Kind regards,
>
> Koen
>
> On 15/03/11 09:22, Carlos wrote:
>> Hi.
>>
>> I want to define an operation on a particular element of my ecore
>> metamodel, and the returning type must be a list of elements.
>> In the ecore editor, I select EEList<?> as the returning type but my
>> problem is that I can't create that kind of lists, neither make a cast
>> from ArrayList to EList.
>>
>> If I had to return eContents from an EObject, I have be able to return
>> an EList, but in my case, I have to return a list of element built by me.
>>
>> (At the moment, I have got a non smart solution based on not to declare
>> the returning type in the ecore editor, and after that I set
>> ArrayList<?> as the returnint type in the signature of the implemented
>> method.
>>
>> Please, have you got any suggestion in order to get something smarter?
>>
>> Thanks in advance.
>> Regards.
>> Carlos.
>
|
|
|
Goto Forum:
Current Time: Sat Apr 20 02:29:55 GMT 2024
Powered by FUDForum. Page generated in 0.02671 seconds
|