Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo3.1] @generated NOT
[Acceleo3.1] @generated NOT [message #685654] Sat, 18 June 2011 00:28 Go to next message
Sergio  is currently offline Sergio Friend
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Hi,


I read that

"If you are generating a Java file, Acceleo features another mechanism to prevent the loss of the user code: JMerge. JMerge is a set of tags in the javadoc used to indicate if an element of a Java file has been generated or not. With a JMerge tag "@generated" you can indicate that this component has been generated and that it should be deleted and regenerated while a "@generated NOT" tag will indicate that all the content of the documented element has been changed by the user and it should not be overwritten by the new generation even outside of a protected area"

But when I try this in my generated code (with m2t-acceleo-Update-3.1.0), it fails.

Example:
/**
* the description setter.
* @return the description.
* @generated NOT
*/
public void setDescription(final String pdescription) {
this.description = pdescription;
}

this doesn't work
Do I have to do something (extra) else ?

thanks!!



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Re: [Acceleo3.1] @generated NOT [message #685844 is a reply to message #685654] Mon, 20 June 2011 11:04 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Sergio,

What exactly "fails"? If you have this in your generated code, the content of the method "setDescription" should never be reset to "this.description = pDescription" if you manually change it to something else. That is how JMerge works.

In other words; if you have this in your module (mtl file) :

/**
* the description setter.
* @return the description.
* @generated
*/
public void setDescription(final String pdescription) {
this.description = pdescription;
}


ou will get this in your generated java file :
/**
* the description setter.
* @return the description.
* @generated
*/
public void setDescription(final String pdescription) {
this.description = pdescription;
}


Now, if you change your generated file to this :

/**
* the description setter.
* @return the description.
* @generated
*/
public void setDescription(final String pdescription) {
this.description = pdescription;
// A new line
}


the line "// A new line" will be removed with a new generation. If you change it to this instead :

/**
* the description setter.
* @return the description.
* @generated NOT
*/
public void setDescription(final String pdescription) {
this.description = pdescription;
// A new line
}


That line will not be removed with a new generation.

Does that help?

Laurent Goubet
Obeo
Re: [Acceleo3.1] @generated NOT [message #685846 is a reply to message #685844] Mon, 20 June 2011 11:06 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

You can also find a video of JMerge used in Acceleo on the Obeo Network.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [Acceleo3.1] @generated NOT [message #685943 is a reply to message #685846] Mon, 20 June 2011 21:18 Go to previous message
Sergio  is currently offline Sergio Friend
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Thank you Stephane. Yes, I know the video and the samples...

Maybe is something wrong in my eclipse, I'll try another time.



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Previous Topic:Acceleo 7June 2011 Release Help (version 3.1)
Next Topic:Text Production Rules
Goto Forum:
  


Current Time: Sun Dec 08 22:09:20 GMT 2024

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

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

Back to the top