|
Re: [Acceleo 3] Protected Area [message #655150 is a reply to message #655097] |
Fri, 18 February 2011 13:57   |
|
Hi Alexandre,
So let me explain protected areas:
1- you generate some code, then you modify that generated code and you launch the generation once again -> your modification in the generated files are lost
2- you generate some code with a protected area (with an unique identifier -> [protected ('myIdentifier')] ... [/protected] in a given file), you modify your generated code inside of the protected area and outside of the protected area, you launch the generation once again -> the code modified in the generated file outside of the protected area is lost, the code modify inside of the protected area is still there.
Since with a code generation project, you will one day have to modify the generated code. Even when you think that you won't, you will because you will be lazy / late / anything else 
The protected area allow you to prepare some parts of the generated code for modifications. You can predict where those modifications should appear and where your generator will support those modifications.
If you create an UML to Java generator, you want to create a protected area between the last attribute and the constructor so that you can modify without risk the generated code to add a new attributes and you want to create a protected area after all your generated method to give the user the opportunity to add new methods.
For more information on protected area, you can find here a video that I've realized for the conference Topcased Days, during the "part 7" I show how protected areas work (start at 7min 25s in the video part7).
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
[Updated on: Fri, 18 February 2011 13:58] Report message to a moderator
|
|
|
|
|
|
Re: [Acceleo 3] Protected Area [message #656410 is a reply to message #656367] |
Fri, 25 February 2011 13:34  |
|
Hi Alexandre,
Acceleo does not allow anything to be located between the protected area identifier and the following line separator. Your first use case is wrong because of that, the second correct.
If you really need to put something there, you have to make it be part of the protected area identifier.
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.03015 seconds