Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Adapt Getters/Setters syntax
Adapt Getters/Setters syntax [message #870663] Wed, 09 May 2012 09:30 Go to next message
tony hedoux is currently offline tony hedouxFriend
Messages: 19
Registered: May 2012
Junior Member
Hi,

I am currently working with code generated via EMF.
We are prefixing our attributes with letters, but we would like to have getters/setters generated by EMF with normal syntax.

For example :
attribute : String mPipo;
Generated getter : public String getMPipo(){...}
Wanted getter : public String getPipo(){...}

By looking at Class.javajet template, it seems that method used for defined accessor name is genFeature.getGetAccessorName.

I fail to find where this method search its template for format getter name.

How can we tell to EMF using an other template without rewrite half of *javajet files?

Thx for help,

Tony.
Re: Adapt Getters/Setters syntax [message #870668 is a reply to message #870663] Wed, 09 May 2012 09:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Tony,

Comments below.

On 09/05/2012 11:31 AM, tony hedoux wrote:
> Hi,
>
> I am currently working with code generated via EMF.
> We are prefixing our attributes with letters, but we would like to
> have getters/setters generated by EMF with normal syntax.
What's the purpose of such prefixes? All names in the Ecore model will
be used directly to produce the Java names so best you use well formed
Java names.
>
> For example :
> attribute : String mPipo;
> Generated getter : public String getMPipo(){...}
> Wanted getter : public String getPipo(){...}
>
> By looking at Class.javajet template, it seems that method used for
> defined accessor name is genFeature.getGetAccessorName.
Yes.
>
> I fail to find where this method search its template for format getter
> name.
It doesn't use a template. It's implemented in the GenModel logic.
>
> How can we tell to EMF using an other template without rewrite half of
> *javajet files?
You can't.

If you want to control the names that appear in the XML/XMI, it would be
better to use extended meta data annotations for those and use nice Java
names for the actual model.

>
> Thx for help,
>
> Tony.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Adapt Getters/Setters syntax [message #870712 is a reply to message #870668] Wed, 09 May 2012 12:25 Go to previous message
tony hedoux is currently offline tony hedouxFriend
Messages: 19
Registered: May 2012
Junior Member
Ok, thx for theses informations.
Previous Topic:[EMF Query 2] Help with writing conditions
Next Topic:Limitation of EObjectContainmentEList
Goto Forum:
  


Current Time: Sat Apr 20 03:48:51 GMT 2024

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

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

Back to the top