Previous | UML Classes | Table of Contents | UML Packages | Next |
A classifier template parameter exposes a classifier as a formal template parameter.
•
TemplateParameter (from Templates) on page 653
Description
ClassifierTemplateParameter is a template parameter where the parametered element is a Classifier in its capacity of being
a kind of ParameterableElement.
Attributes
• allowSubstitutable : Boolean[1] Constrains the required relationship between an actual parameter and the parameteredElement
for this formal parameter. Default is true.
Associations
• parameteredElement : Classifier[1] The parameterable classifier for this template parameter. Redefines TemplateParameter::parameteredElement.
Issue 8265 -add constrainingClassifier and defaultClassifier items
• constrainingClassifier : Classifier [0..1] The classifier that constrains the argument that can be used for the parameter. If the allowSubstitutable attribute is true, then any classifier that is compatible with this constraining classifier can be substituted, otherwise it must be either this classifier or one of its subclasses. If this property is empty, there are no constraints on the classifier that can be used as an argument.
• defaultClassifier : Classifier [0..1] The classifier that is used by default if no argument is provided during template binding. If this property is empty, then there is no default.
Constraints
Issue 8265 -add new constraint
[1] If allowSubstitutable is true, then there must be a constrainingClassifier
allowSubstitutable implies constrainingClassifier->notEmpty()
Semantics
See Classifier for additional semantics related to the compatibility of actual and formal classifier parameters.
Notation
A classifier template parameter extends the notation for a template parameter to include an optional type constraint: <classifier-template-parameter>
::= <parameter-name> [ ‘:‘ <parameter-kind> ] [‘>’ <constraint>] [‘=’ <default>] <constraint> ::= [‘{contract }’] <classifier-name>
<default> ::= <classifier-name> The parameter-kind indicates the metaclass of the parametered element. It may be suppressed
if it is ‘class’.
Issue 8528 - replace ‘allowsSubstitutable’ with ‘allowSubstitutable’
The classifier-name of constraint designates the type constraint of the parameter, which reflects the general classifier for
the parametered element for this template parameter. The ‘contract’ option indicates that allowSubstitutable is true, meaning
the actual parameter must be a classifier that may substitute for the classifier designated by the classifier-name. A classifier
template parameter with a constraint but without ‘contract’ indicates that the actual classifier must be a specialization
of the classifier designated by the classifier-name.
Examples
See Classifier.