Book a Demo

Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Add New Stereotyped Templates

Sometimes it is useful to define a specific code generation template for use with elements of a given stereotype. This enables different code to be generated for elements, depending on their stereotype. Enterprise Architect provides some default templates, which have been specialized for commonly used stereotypes in supported languages. For example, the 'Operation Body' template for C# has been specialized for the property stereotype, so that it automatically generates its constituent 'get' and 'set' methods. You can override the default stereotyped templates as described in the Override Default Templates topic. Additionally, you can define templates for your own stereotypes, as described here.



Code > Configure > Options > Edit Code Templates

Keyboard Shortcuts


Add a new stereotyped template using the Code Template Editor



See also


Select the appropriate language, from the Language list.


Select one of the base templates, from the Templates list.


Click on the 'Add New Stereotyped Override' button.

The 'New Template Override' dialog displays.


Select the required Feature and/or Class stereotype.

Click on the OK button.


The new stereotyped template override displays in Stereotype Overrides list, marked as modified.


Make the required modifications in the Code Templates Editor.


Click on the Save button to store the new stereotyped template in the project file.

Enterprise Architect can now use the stereotyped template, when generating code for elements of that stereotype.


  • Class and feature stereotypes can be combined to provide a further level of specialization for features; for example, if properties should be generated differently when the Class has a stereotype MyStereotype, then both property and MyStereotype should be specified in the New Template Override dialog