Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How to add a map with generics?
How to add a map with generics? [message #1764654] Thu, 01 June 2017 08:14 Go to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 48
Registered: January 2013
Member
Hi,
I use Ecoretools and want to add a java.util.Map to my model with the key type java.lang.String and the value type my.ClazzType where my.ClazzType is also part of the same model.

I want to use the map as attribute in one of my classes of this same model.

What steps do I have to follow to add this in the class diagram?

With regards,
Udo
Re: How to add a map with generics? [message #1764660 is a reply to message #1764654] Thu, 01 June 2017 08:46 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Maps are not one of EMF's strongest facilities. I failed to use them for many years but eventually felt guilty and tried again. You can find an example and some of my troubles in

https://bugs.eclipse.org/bugs/show_bug.cgi?id=443021
https://bugs.eclipse.org/bugs/show_bug.cgi?id=443195

To be honest, my recommendation is that if you want non-trivial efficient Maps you consider implementing them by manual coding behind a modeled API in the generated Java classes.

Regards

Ed Willink
Re: How to add a map with generics? [message #1764669 is a reply to message #1764660] Thu, 01 June 2017 09:33 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
See https://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF.3F for details. You can accomplish the same tasks as described in the FAQ using the Ecore Tools editor. It obviously works because Ecore itself uses it and we have many cases of using it in Oomph's setup models.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Question Generating from XSD
Next Topic:EMFStore on Tomcat: How to set it up using MongoDB?
Goto Forum:
  


Current Time: Wed Apr 24 22:39:02 GMT 2024

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

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

Back to the top