You can create a Java™ code template that the UML-to-Java
and the UML-to-EJB transformation use to generate code. The transformation uses the template to enclose
the generated method bodies. When you rerun the transformation, it does not
overwrite the code that the template encloses.
To protect generated code when you rerun a transformation:
- Click .
- In the Preferences window, from Configure
generated code and comments list, expand Code and
click Method body.
- Click Edit.
- In the Edit Template window, insert the following
code:
// begin-user-code
// ${todo} Auto-generated method stub
${body_statement}
// end-user-code
- To avoid syntax errors when you rerun the transformation, after //
end-user-code, press Enter.
- Click OK.