UML Template
UML templates allow classifiers, collaborations, packages, operations to be parameterized with template parameters. See, for example:
An example of a template - Value Object Package Template.
Templateable Element
A templateable element is an element that can optionally be defined as a template or bound to other templates.
Template class Array and bound class Customers.
Template
Template is a templateable element that contains a template signature.
Collaboration template Visit with two unconstrained class formal parameters.
Bound Element
Bound element is a templateable element that contains bindings to templates that describe how the templateable element is constructed by replacing the formal template parameters with actual parameters.
Package template Service Provider and bound package Scheduler Service.
Template Signature
A template signature is an element which specifies the ordered set of formal template parameters for a template.
Formal template parameters are shown in a dashed rectangle superimposed on the symbol for the template, typically on the upper right-hand corner. The list of the formal template parameters should not be empty, having at least one formal parameter.
The formal template parameter list may be shown as a comma-separated list, or it may be one formal template parameter per line.
Note, that UML specification allows to suppress the template signature on the diagram.
Template Parameter
A template parameter is an element which exposes a parameterable element as a formal template parameter of a template. It is owned by a template signature.
The formal template parameter constrains the elements that may be substituted as actual parameters in a template binding. The formal template parameter could be only used within the template and its specializations, if any. It may not be used in other parts of the model.
Formal template parameter is displayed within the template parameter list using the following syntax:
template-parameter ::= template-param-name [ ':' parameter-kind ] [ '=' default ]
Template Binding
Template binding is a directed relationship from a bound element to the template signature of the target template.
Template binding specifies and owns a set of template parameter substitutions of actual parameters for the formal parameters of the template.
Template binding is shown as a dashed arrow decorated with the keyword «bind» and binding information, with the hollow triangle arrowhead, and directed from the bound element at the tail to the template.
Binding substitutes class T with class Customer
and boundary n with integer value 24.
The binding information is generally displayed as a comma-separated list of template-param-substititions enclosed in angle brackets '<' and '>':
template-param-substitition ::= template-param-name '->' actual-template-parameter
The syntax of template-param-name is defined by the kind of parametered element for this template parameter substitution, while actual-template-parameter depends upon the kind of the element.