Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to auto create unique identifier for instances?(uid identifier ID create instance set feature)
How to auto create unique identifier for instances? [message #1801815] Sun, 27 January 2019 18:57 Go to next message
Mars Keez is currently offline Mars KeezFriend
Messages: 16
Registered: January 2015
Junior Member
How can I automatically create a unique identifier while creating an instance?

Saw for example "Uid" in Sirius meta model elements. Looks perfect. But how to do this?
Also simpler approaches (timestamp etc) would be appreciated.

ps
been using a name attribute with "ID" property, but that's not enough for my purposes.

Re: How to auto create unique identifier for instances? [message #1801825 is a reply to message #1801815] Mon, 28 January 2019 06:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7669
Registered: July 2009
Senior Member
Hi

How unique?

If you want to differ from anything anywhere anytime, you might use EcoreUtil.generateUUID().

But if you only want uniqueness here, then you produce something much friendlier by counting similarly scoped names and then allocating a name such as scope-name-count. But you must check for collisions and move on because deletions in this or a previous edit session may reduce counts facilitating confusing re-use.

Regards

Ed Willink
Re: How to auto create unique identifier for instances? [message #1801830 is a reply to message #1801825] Mon, 28 January 2019 08:00 Go to previous message
Mars Keez is currently offline Mars KeezFriend
Messages: 16
Registered: January 2015
Junior Member
thx!

have to give the ecore function a try then.
Previous Topic:multiple diagram elements for the same domain class
Next Topic:How to enable and disable Node from Palette
Goto Forum:
  


Current Time: Sun Sep 15 13:39:30 GMT 2024

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

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

Back to the top