简体   繁体   English

如何在EMF ecore模型中创建LinkedHashMap?

[英]How to create a LinkedHashMap in EMF ecore model?

I am looking for keeping the order of my entries in the map based on the insertion order. 我正在寻找根据插入顺序在地图中保持条目顺序的方法。 So basically I am looking for creating a LinkedHashMap in my ecore model. 所以基本上我正在寻找在我的ecore模型中创建LinkedHashMap的方法。

I need to persist this map, hence I'd like to use the serialization and proxy resolution feature of EMap. 我需要保留此映射,因此我想使用EMap的序列化和代理解析功能。 I tried to cast a LinkedHashMap to EcoreEmap by ((EMap.InternalMapView)myLinkedHashMap).eMap(); 我试图通过((EMap.InternalMapView)myLinkedHashMap).eMap();将LinkedHashMap投射到EcoreEmap ((EMap.InternalMapView)myLinkedHashMap).eMap(); but that didn't work. 但这没用。

I can think of having a list and map together, and keep the order in list, but I'd really like to avoid duplication of reference, since these two can get out of sync. 我可以考虑使用一个列表并将其映射在一起,并将顺序保持在列表中,但是我真的想避免重复引用,因为这两个可能会不同步。

Do you have any suggestions? 你有什么建议吗?

If we use EMF EMap class, the insertion order will be kept and we wouldn't need a LinkeHashMap. 如果我们使用EMF EMap类,则将保留插入顺序,并且不需要LinkeHashMap。 More details are discussed here: 此处讨论更多详细信息:

http://www.eclipse.org/forums/index.php/mv/tree/451092/1003801/ http://www.eclipse.org/forums/index.php/mv/tree/451092/1003801/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以编程方式从XSD架构生成EMF模型(.ecore,.genmodel)? - How to programmatically generate an EMF model (.ecore, .genmodel) from XSD schema? 如何在EMF Ecore建模框架中创建自定义属性 - How to create custom attributes in EMF Ecore Modeling Framework 如何在eclipse中创建自定义向导,该向导从EMF ecore模型读取类数据,创建其对象(通过向导)并在导航器中显示它? - How to create a custom wizard in eclipse, which reads class data from EMF ecore model, creates its object (via Wizard) and shows it in navigator? 如何在没有EMF jar依赖的情况下从Ecore元模型创建Java代码? - How create Java code from Ecore metamodel without EMF jar dependences? EMF Ecore 模型中的枚举是否可以实现接口? - Is it possible to have an enumeration in a EMF Ecore model implement an interface? 如何保存 EMF 模型 - How to save an EMF Model 独立的接口和实现 emf 核心 - Separate interfaces and implementation emf ecore 如何修改ecore XML文件以生成除getter和setters Java / EMF之外的方法 - How can I modify my ecore XML file to generate methods other than getters and setters Java/EMF 如何用emf编写多线程模型? - How to write a multithreads model with emf? 如何在ecore中创建上限为1的EReference列表 - How to create EReference list with upper bound of 1 in ecore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM