Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [xcore] using "id" as attribute name
[xcore] using "id" as attribute name [message #1776364] Wed, 15 November 2017 17:39 Go to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1250
Registered: October 2011
Senior Member
I am trying to implement an existing interface with xcore and I need to have a String attribute called "id".

Something like that:
package sample.model

class User {
    String id
}


My problem is that "id" seems to be a special keyword in the xcore dsl.

What are the possibilities?

My current solution is a post processing step (after the code generation) where I modify the name of the attribute with text search and replace.

PS: I cannot change the name of the attribute, because it is driven by an interface that my Ecore-Entity needs to implements (very easy to do with xcore, see my post on that topic)
Re: [xcore] using "id" as attribute name [message #1776396 is a reply to message #1776364] Thu, 16 November 2017 07:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29130
Registered: July 2009
Senior Member
You can use ^ to "escape" keywords.
package ^package

class Class
{
	id String ^id
}
Re: [xcore] using "id" as attribute name [message #1776397 is a reply to message #1776396] Thu, 16 November 2017 08:03 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1250
Registered: October 2011
Senior Member
Thank you a lot!
Previous Topic:[CDO] Security Model, I dont want that user can see all directories
Next Topic:[CDO] Timeout while prefetching
Goto Forum:
  


Current Time: Mon Jan 22 20:34:02 GMT 2018

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

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