Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8130209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:37:34+00:00 2026-06-06T08:37:34+00:00

I use Acceleo in order to generate code with a model I have made.

  • 0

I use Acceleo in order to generate code with a model I have made. I managed to protect my methods in order to protect them usinig “@generated NOT” in case I need to regenerate my code with Acceleo. The problem is that adding @generated NOT protect all the method content, that is to say the body, the signature and JavaDocs.

The thing is that I only need to keep the method body, or at least the method body and its signature, but I need the doc to be updated. How can I do this ?

Just for information here is an example of a potential generated class :

/*
 * @generated
 */
public class ActeurRefEntrepriseServicesImpl implements ActeurRefEntrepriseServices {

    @Autowired
    HelloWorldService helloWorldService;

    /**
     * Service which say hello
     * 
     * @param name
     *           user name
     * @return print Hello username
     * 
     * @generated NOT
     */
    @Override
    public void sayHello(final String name) {
        helloWorldService.print(name);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:37:36+00:00Added an answer on June 6, 2026 at 8:37 am

    Baptiste,

    The @generated tags use the standard EMF protection rules : “@generated” means that the body of the block for which it is set will be generated, anything else means no re-generation. If you set something as “@generated” in any of your metamodels’ generated code, you will see that there, too, the javadoc is preserved whatever the edits you do.

    In short, you cannot tell EMF to re-generate anything other than the code itself.

    If you need to have the body protected but not the javadoc, you have to shift from the “@generated” protection to Acceleo’s [protected] blocks. i.e, change your template from :

    [template generatedMethod(methodName : String)]
        /**
         * Some doc.
         * @param param1
         *           param documentation.
         * @generated
         */
        [generateSignature(methodName)/] {
            [generateBody()/]
        }
    [/template]
    

    to something using a protected block :

    [template generatedMethod(methodName : String)]
        /**
         * Some doc.
         * @param param1
         *           param documentation.
         */
        [protected (methodName)]
        [generateSignature(methodName)/] {
            [generateBody()/]
        }
        [/protected]
    [/template]
    

    With this paradigm, anything that is outside of the protected area will be regenerated, everything else will remain untouched by a regeneration.

    See also the full documentation available from the Acceleo website.

    If you absolutely need to use the “@generated” protection method for your model, you will need to tamper with the JMerger API from EMF and alter the launcher Acceleo generated for you in order to use your own merging strategy (see the getGenerationStrategy method from that launcher). Note that this is by no means an easy task.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use case: I find a piece of code that I do not understand at
Use Elixir and have two entities -- Voter and Candidate -- with many to
use javascript or other method ? have any recommendation?
Use case example: Client A comes to request sales information, enters their zip code
Use case: You have 2-3 files displayed in your MacVim window(s). You press ctrl+Q
Use scenario is pretty simple: I have a desktop only application that could be
use this code, in the Preferences activity, to know when the reset preference has
Use case is to have a server connect to thousands of users email accounts
use case example I have a servlet that is receiving login requests. If a
Use case: 3rd party application wants to programatically monitor a text file being generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.