An extension is association relationship used to indicate that the properties of a metaclass are extended through a stereotype, and gives the ability to flexibly add stereotypes to classes and remove later, if necessary.
One end of the extension association is an ordinary property and the other end is an extension end. The property ties the extension to a metaclass, while the extension end ties the extension to the stereotype extending the metaclass.
Extension end is a navigable end, owned by extension. This allows a stereotype instance to be attached to an instance of the extended classifier without adding a property to the classifier. Note, that until UML 2.3 extension end was "never navigable".
The notation for an extension is an arrow with the filled triangle arrowhead pointing from a stereotype to the extended metaclass.
Because extension is subclass of association, it may have usual association adornments, but navigability arrows should not be shown. Adornments of an extension are typically suppressed.
A non-required extension means that an instance of a stereotype can be linked to an instance of an extended metaclass at will, and also later deleted at will. However, there is no requirement that each instance of a metaclass be extended. An instance of a stereotype is deleted when either the instance of the extended metaclass is deleted, or when the profile defining the stereotype is removed from the applied profiles of the package.
By default, extension is non-required. When extension has no adornments, it could either mean the default value or that the {required} adornment was suppressed. Multiplicity 0..1 on the extension end could be used as an alternative to non-required extension.
A required extension means that an instance of a stereotype must always be linked to an instance of the extended metaclass. The instance of the stereotype is typically deleted only when either the instance of the extended metaclass is deleted, or when the profile defining the stereotype is removed from the applied profiles of the package.
Required extension is shown using the {required} property near the extension end.
It is also allowed to use multiplicity 1 on the extension end as an alternative to the {required}.
A metaclass may be extended by one or more stereotypes. This is obvious and expected. However, it may cause unexpected behavior, e.g., when stereotype Provider extends either (or both?) Interface or Class metaclasses. In such cases it should clearly be noted and documented when is Interface or Class used. In the case of SoaML (see next chapter) Interface is used for a non-composite service contract while Class is used for a composite service contract.
Figure 6.22. Stereotype Provider extends either (or both?) Interface or Class metaclasses [UML-DIAGRAMS.ORG]
![]() |