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. Users can override the default stereotyped templates as described in the Override Default Templates topic. Additionally users can define templates for their own stereotypes, as described below.

Access    Configuration | Code Generation Templates

How to

To add a new stereotyped template using the Code Templates 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 .EAP 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

Learn more