Prev Next

Parameterized Classes (Templates)

Enterprise Architect supports template or parameterized Classes, which specify parameters that must be defined by any binding Class.

Parameterized Classes are commonly implemented in C++; Enterprise Architect imports and generates templated Classes for C++.

The functionality of a template Class can be reused by any bound Class. If a default value is specified for a parameter, and a binding Class doesn't provide a value for that parameter, the default is used.

Create a parameterized Class

Step

Action

1

Press Alt+1 to display the Properties window for the required Class.

2

Select the 'Templates' tab.

3

In the 'Template Parameter(s)' panel, click on the Add button.

The 'Template Parameter' dialog displays.

4

Type in the name and type of the parameter and, if required, click on the Browse. button after the 'Constraints' and 'Default' fields to select the required constraining and default Classes from the 'Select <Item>' dialog.

The default Class can be either the constraining classifier or any Class that derives from the constraining classifier.

Notation Example

On a diagram, template Classes are shown with the parameters in a dashed outline box in the upper right corner of the Class.

UML Class diagram showing a parameterized UML Class element using Sparx Systems Enterprise Architect..

OMG UML Specification

The OMG UML specification (UML Superstructure Specification, v2.1.1, p. 622) states:

A template is a parameterized element that can be used to generate other model elements using TemplateBinding relationships. The template parameters for the template signature specify the formal parameters that will be substituted by actual parameters (or the default) in a binding.

Learn more