Templates

In UML models, templates are model elements with unbound formal parameters that you can use to define families of classifiers, packages, and operations.

A template is a parameterized model element that describes or identifies the pattern for a group of model elements of a particular type. Because they represent types of elements, you cannot use templates directly in your models. Instead, you must first instantiate the template by binding its parameters to actual values. A binding between a template and a model element generates a new model element based on the template. You can then use the bound element to model part of a system.

Instead of designing distinct model elements for each data type in your model, you can use templates to design a single model element (a classifier, a package, or an operation) that works with different kinds of data. For example, a template class provides a parameterized description of a class, specifying its attributes and operations. By binding multiple classes to the template you can generate new classes with the same characteristics as the template.

A template appears as a classifier with a dashed box in the upper right corner.

Parent topic: Class diagrams

Related tasks
Modifying parameters, literals, and signals in classifiers
Modifying template parameters and arguments
Adding template parameters to classes and collaborations
Deleting template parameters

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.