There are two types of code that can be in a UML Modeling source file: source code that is written by you or source code that is generated by the UML Modeling tool. During the source code generation process, preference settings defined in domain templates determine which template files and output parameters are to be used. By default, the generated source code is annotated with the //#[regen=yes, id=<generated_value>]
tag.
When source code for a UML model is regenerated, the source code synchronization process will replace the source code element that have the //#[regen=yes]
tag immediately preceding it. If you manually remove the //#[regen=yes]
tag, the source code synchronization process will no longer automatically replace the source code element that was previously generated.
In the Generate Code dialog, you can specify that merge markers be added to existing unmarked source code elements. The marker comments appear in the format of //#[(name=value(,name=value)*?]
where the "name=value"
parameters can be one or more of the following:
Parameter | Definition |
---|---|
regen=yes/no |
Specifies whether the source code element can be regenerated. If this parameter is not present, the code element will not be regenerated |
regenBody=yes/no |
Specifies whether the source code element's header can be regenerated or whether the header and the body can be regenerated. If the parameter is not present, the default value is no . |
id=<a unique id value> |
Used to initially match elements (types, attributes, methods, or enumerated literals) in the newly generated file against the previous version of the source file |
You can also manually add markers as a single line comment immediately preceding the element to be marked. The only parameters that are allowed to be manually added are the first two parameters in the above table. The id
parameter is auto-generated and added during the next code generation process.