Override Default Templates

Return to Introduction  Previous page  Next page

Enterprise Architect has a set of built-in or default code generation templates. The Code Templates Editor enables you to modify these default templates, hence customizing the way in which Enterprise Architect generates code. You can choose to modify any or all of the base templates to achieve your required coding style.

Any templates that you have overridden are stored in the .EAP file. When generating code, Enterprise Architect first checks whether a template has been modified and if so, uses that template. Otherwise the appropriate default template is used.


To override a default code generation template, follow the steps below.

1.Select the Configuration | Code Generation Templates menu option. The Code Templates Editor displays.
2.Select the appropriate language from the Language list.
3.Select one of the base templates from the Templates list.
4.If the base template has stereotyped overrides, you can select one of these from the Stereotype Overrides list.
5.In the Code Templates Editor, make the required modifications.
6.Click on the Save button. This stores the modified version of the template to the .EAP file. The template is marked as modified.

When generating code, Enterprise Architect now uses the overridden template, instead of the default template.