Previous UML Classes Table of Contents UML Packages Next


17.5.4 TemplateParameter

Templates


   A template parameter exposes a parameterable element as a formal template parameter of a template.

*Generalizations

   

    Element (from Kernel ) on page 63

   Description

   TemplateParameter references a ParameterableElement that is exposed as a formal template parameter in the containing template.

   Attributes

   No additional attributes

   Associations

   • default : ParameterableElement[0..1] The element that is the default for this formal template parameter.

   • ownedDefault : ParameterableElement[0..1] The element that is owned by this template parameter for the purpose of providing a default. Subsets default and Element::ownedElement.

   • ownedParameteredElement : ParameterableElement[0..1] The element that is owned by this template parameter. Subsets parameteredElement and Element::ownedElement.

   Constraints

   [1] The default must be compatible with the formal template parameter.

   default->notEmpty() implies default->isCompatibleWith(parameteredElement)

Issue 8264 - remove invalid constraint

   Semantics

   A TemplateParameter references a ParameterableElement that is exposed as a formal template parameter in the containing template. This parameterable element is meaningful only within the template, or other templates that may have access to its internals (e.g., if the template supports specialization). The exposed parameterable element may not be used in other parts of the model. A TemplateParameter may own the exposed ParameterableElement in situations where that element is only referenced from within the template.

   Each exposed element constrains the elements that may be substituted as actual parameters in a binding.

   A TemplateParameter may reference a ParameterableElement as the default for this formal parameter in any binding that does not provide an explicit substitution. The TemplateParameter may own this default ParameterableElement in situations where the exposed ParameterableElement is not owned by the TemplateParameter.

   Notation

   The general notation for a template parameter is a string displayed within the template parameter list for the template:

   <template-parameter> ::= <template-param-name> [‘:’ <parameter-kind> ] [‘=’ <default>]

   where <parameter-kind> is the name of the metaclass for the exposed element. The syntax of <template-param-name> depends on the kind of parameteredElement for this template parameter substitution and of <default> depends upon the kind of element. See ParameterableElement (from Templates) on page 647 (and its subclasses).

   Examples

   See TemplateableElement.