Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Collections as return types of EOperations
Collections as return types of EOperations [message #422954] Fri, 19 September 2008 15:00 Go to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
How can I define an EOperation whose return type is a typed collection.
What I want generated is this:

public Set<MyModelType> getFoo();

If Set isn't possible or easy, I'd settle for Collection<MyModelType> or
List<MyModelType>.


In the ecore editor I can't seem to find anything appropriate to select
as the EType property of my EOperation.

Thanks in advance,
Eric
Re: Collections as return types of EOperations [message #422962 is a reply to message #422954] Fri, 19 September 2008 16:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
Hi,

Create your own EDataType where you wrap the java-Set-interface, or did
I get this wrong?

Tom

Eric Rizzo schrieb:
> How can I define an EOperation whose return type is a typed collection.
> What I want generated is this:
>
> public Set<MyModelType> getFoo();
>
> If Set isn't possible or easy, I'd settle for Collection<MyModelType> or
> List<MyModelType>.
>
>
> In the ecore editor I can't seem to find anything appropriate to select
> as the EType property of my EOperation.
>
> Thanks in advance,
> Eric


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Collections as return types of EOperations [message #422966 is a reply to message #422962] Fri, 19 September 2008 16:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31478
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030200030204050109090500
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Guys,

If you use "Sample Ecore Editor -> Show Generics", it's also possible to
create an EDataType for java.util.Set (much like the one in Ecore.ecore
for EEList) and then to use a generic type that refers to your "Set"
EDataType has has a type argument (use the create child menus for that)
for the MyModelType (much like EObject's eContents EOperation in
Ecore.ecore).


Tom Schindl wrote:
> Hi,
>
> Create your own EDataType where you wrap the java-Set-interface, or did
> I get this wrong?
>
> Tom
>
> Eric Rizzo schrieb:
>
>> How can I define an EOperation whose return type is a typed collection.
>> What I want generated is this:
>>
>> public Set<MyModelType> getFoo();
>>
>> If Set isn't possible or easy, I'd settle for Collection<MyModelType> or
>> List<MyModelType>.
>>
>>
>> In the ecore editor I can't seem to find anything appropriate to select
>> as the EType property of my EOperation.
>>
>> Thanks in advance,
>> Eric
>>
>
>
>

--------------030200030204050109090500
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Guys,<br>
<br>
If you use "Sample Ecore Editor -&gt; Show Generics", it's also
possible to create an EDataType for java.util.Set (much like the one in
Ecore.ecore for EEList) and then to use a generic type that refers to
your "Set" EDataType has has a type argument (use the create child
menus for that) for the MyModelType (much like EObject's eContents
EOperation in Ecore.ecore).<br>
<br>
<br>
Tom Schindl wrote:
<blockquote cite="mid:gb0jof$krl$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,

Create your own EDataType where you wrap the java-Set-interface, or did
I get this wrong?

Tom

Eric Rizzo schrieb:
</pre>
<blockquote type="cite">
<pre wrap="">How can I define an EOperation whose return type is a typed collection.
What I want generated is this:

public Set&lt;MyModelType&gt; getFoo();

If Set isn't possible or easy, I'd settle for Collection&lt;MyModelType&gt; or
List&lt;MyModelType&gt;.


In the ecore editor I can't seem to find anything appropriate to select
as the EType property of my EOperation.

Thanks in advance,
Eric
</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
</body>
</html>

--------------030200030204050109090500--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[EMF & Teneo] Generating Java Packages for Ecore Packages with only subpackages
Next Topic:CDO: Problem with dynamic model
Goto Forum:
  


Current Time: Thu Sep 24 11:18:56 GMT 2020

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

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

Back to the top