Parameterized Classes (Templates)

Enterprise Architect supports template or parameterized Classes, which specify parameters that must be defined by any binding Class. A template Class enables its functionality to 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. Parameterized Classes are commonly implemented in C++.

Enterprise Architect imports and generates templated Classes for C++. Template Classes are shown with the parameters in a dashed outline box in the upper right corner of a Class.

To create a parameterized Class, follow the steps below:

  1. Display the Properties dialog for a Class.
  2. Select the Details tab.
  3. In the Type field, click on the drop-down arrow and select Parameterized.
    For an instantiated template, select Instantiated and add the arguments in the Arguments field.
  4. Click on the Add button and define the required parameters in the Class Parameter dialog.

Notation Example

Example of a Parameterized Class

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.