Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Carlos  is currently offline Carlos Friend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #659715 is a reply to message #659673] Tue, 15 March 2011 09:58 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 671
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 15.03.11 09.22, Carlos wrote:
>
> 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.

I use EEList as the return type and BasicEList as the implementation.
I.e. use BasicEList instead of ArrayList in the code that builds the result.

Hallvard
Re: Defining ECore operations that return EList [message #659750 is a reply to message #659714] Tue, 15 March 2011 13:45 Go to previous message
Eclipse UserFriend
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.
>
Previous Topic:[Teneo] Using Hibernate Envers with Teneo
Next Topic:template proposals (ctrl+space)
Goto Forum:
  


Current Time: Wed Oct 23 18:21:19 GMT 2019

Powered by FUDForum. Page generated in 0.01673 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top