Previous | UML Classes | Table of Contents | UML Packages | Next |
A template binding represents a relationship between a templateable element and a template. A template binding specifies the
substitutions of actual parameters for the formal parameters of the template.
•
DirectedRelationship (from Kernel ) on page 62
Description
TemplateBinding is a directed relationship from a bound templateable element to the template signature of the target template.
A TemplateBinding owns a set of template parameter substitutions.
Attributes
No additional attributes
Associations
• parameterSubstitution : TemplateParameterSubstitution [*] The parameter substitutions owned by this template binding. Subsets
Element::ownedElement.
Issue 8513 -add subsets constraint for ‘Element::owner’ and fix font; also change ‘template’ to ‘signature’
• boundElement : TemplateableElement[1] The element that is bound by this binding. Subsets DirectedRelationship ::source and Element::owner.
• signature: TemplateSignature[1] The template signature for the template that is the target of the binding. Subsets DirectedRelationship ::target.
Constraints
[1] Each parameter substitution must refer to a formal template parameter of the target template signature.
parameterSubstitution ->forAll(b | template.parameter->includes(b.formal))
[2] A binding contains at most one parameter substitution for each formal template parameter of the target template signature.
template.parameter->forAll(p | parameterSubstitution ->select(b | b.formal = p)->size() <= 1)
Semantics
The presence of a TemplateBinding relationship implies the same semantics as if the contents of the template owning the target
template signature were copied into the bound element, substituting any elements exposed as formal template parameters by
the corresponding elements specified as actual parameters in this binding. If no actual parameter is specified in this binding
for a formal parameter, then the default element for that formal template parameter (if specified) is used.
Semantic Variation Points
It is a semantic variation point
•
if all formal template parameters must be bound as part of a binding (complete binding), or
•
if a subset of the formal template parameters may be bound in a binding (partial binding).
In case of complete binding, the bound element may have its own formal template parameters, and these template parameters
can be provided as actual parameters of the binding. In case of partial binding, the unbound formal template parameters are
formal template parameters of the bound element.
Notation
A TemplateBinding is shown as a dashed arrow with the tail on the bound element and the arrowhead on the template and the
keyword «bind». The binding information is generally displayed as a comma-separated list of template parameter substitutions:
<template-param-substitition> ::= <template-param-name> ‘->’ <actual-template-parameter>
where the syntax of <template-param-name> depends on the kind of ParameteredElement for this template parameter substitution
and the kind of <actual-template-parameter>
depends upon the kind of element. See ParameterableElement
(from Templates) on page 647 (and its subclasses).
Examples
Issue 8513 -add proper cross-references
For examples of templates, the reader is referred to those sections that deal with specializations of TemplateableElement,
in particular
ClassifierTemplates on page 656 and
PackageTemplates on page 664.