[Acceleo3.1] @generated NOT [message #685654] |
Sat, 18 June 2011 00:28  |
Eclipse User |
|
|
|
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!!
|
|
|
Re: [Acceleo3.1] @generated NOT [message #685844 is a reply to message #685654] |
Mon, 20 June 2011 11:04   |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03579 seconds