Uml Stereotypes In Sequence Diagram
UML Stereotype
Stereotype is a profile class which defines how an existing metaclass may be extended as part of a profile. It enables the use of a platform or domain specific terminology or notation in place of, or in addition to, the ones used for the extended metaclass.
A stereotype cannot be used by itself, but must always be used with one of the metaclasses it extends. Stereotype cannot be extended by another stereotype.
A stereotype uses the same notation as a class, with the keyword «stereotype» shown before or above the name of the stereotype. Stereotype names should not clash with keyword names for the extended model element.
Servlet Stereotype extends Component.
Stereotype can change the graphical appearance of the extended model element by using attached icons represented by the Image profile class.
Stereotype Servlet with attached custom icon.
Actor is extended by stereotype Web Client with attached custom icon.
Because stereotype is a class, it may have properties. Properties of a stereotype are referred to as tag definitions. When a stereotype is applied to a model element, the values of the properties are referred to as tagged values.
Device extended by Server stereotype with tag definitions and custom icon.
Stereotype Application
Profile diagram is used to show definition of stereotype. Stereotype is applied when it is used on use case diagrams, class diagrams, deployment diagrams, etc.
When a stereotype is applied to a model element, an instance of the stereotype is linked to an instance of the metaclass. The name of the applied stereotype is shown within a pair of guillemets above or before the name of the model element.
UML versions before 2.4 required the first letter of the name of the applied stereotype to be in lower case (e.g. «servlet»). Starting from UML 2.4, the first letter should normally be in upper case. Naming stereotype applications with lower-case letters where the stereotypes themselves are defined using upper-case first letter is still valid but is considered obsolete.
Stereotype «Servlet» applied to
the model element SearchServlet
If multiple stereotypes are applied to the same element, the names of the applied stereotypes are shown as a comma-separated list within a pair of guillemets.
When the extended model element has a keyword, then the stereotype name could be displayed close to the keyword, within separate guillemets (example: «device» «server»).
When a stereotype includes the definition of an icon, this icon can be graphically attached to the model elements extended by the stereotype. Every model element that has a graphical presentation can have an attached icon. When a model element is extended by one single stereotype the icon can be presented in a reduced shape, inside and on top of the box representing the model element.
Servlet stereotype applied to the class SearchServlet.
When stereotype is applied, the whole classifier box can be replaced by enlarged icon of the stereotype.
Servlet stereotype applied to the class SearchServlet.
Some model elements are already using an icon for their default presentation. A typical example of this is the actor model element, which uses the "stickman" icon. In that case, when a model element is extended by a stereotype with an icon, the stereotype's icon replaces the default presentation icon within diagrams.
«Web Client» stereotype applied to the Geek actor.
Computer stereotype with tags applied to Device class.
Stereotype Relationships
A stereotype must always be used in conjunction with one of the metaclasses it extends. A metaclass may be extended by one or more stereotypes. Each stereotype may extend one or more metaclasses.
Stereotypes can participate in binary association. The opposite class can be another stereotype, a non-stereotype class owned by a profile or a metaclass. The stereotype must own property at the association end to be able to navigate to the opposite class. If the opposite end is not a stereotype, the opposite property must be owned by the association itself.
A stereotype may generalize or specialize only another stereotype.
Abstract stereotype Session EJB is specialized by
stereotypes Stateless EJB and Stateful EJB.
Tag Definition
Properties of a stereotype are referred to as tag definitions (or metaproperties).
Stereotype Computer with tag definitions for vendor, CPU, and memory
Tagged Value
Stereotype is applied when it is used on use case diagrams, class diagrams, deployment diagrams, etc.
When a stereotype is applied to a model element, the values of its properties may be referred to as tagged values.
UML 1.x defined tagged value as one of UML extensibility mechanisms permitting arbitrary information (which could not be expressed by UML) to be attached to models. Tagged value is a keyword-value pair that may be attached to any kind of model element.
The keyword is called a tag. Each tag represents a particular kind of property applicable to one or many kinds of model elements. Both the tag and the value are usually encoded as strings though UML tool allow to use other data types for values.
Tagged value specification in UML 1.x has the form
name = value
where name is the name of a tag or metamodel attribute and value is an arbitrary string that denotes its value. For example,
{author="Joe Smith", deadline=31-March-1997, status=analysis}
Boolean tags frequently have the form isQuality, where quality is some condition that may be true or false. In these cases, the form "quality" may usually appear by itself, without a value and defaulting to true. For example, {abstract} is the same as {isAbstract=true}. To specify a value of false, omit the name completely. Tags of other types require explicit values.
Tagged value (as well as metamodel attribute) is displayed as a comma delimited sequence of properties inside a pair of curly braces "{" and "}".
Stereotype Computer applied
using "traditional" tag values notation.
In UML 1.3 tagged values could extend a model element without requiring the presence of a stereotype. In UML 1.4, this capability, although still supported, was deprecated, to be used only for backward compatibility reasons.
Since UML 2.0, a tagged value can only be represented as an attribute defined on a stereotype. Therefore, a model element must be extended by a stereotype in order to be extended by tagged values. To support compatibility with the UML 1.3 some UML tools can automatically define a stereotype to which "unattached" attributes (tagged values) will be attached.
Tag values could be shown in class compartment under stereotype name. An additional compartment is required for each applied stereotype whose values are to be displayed. Each such compartment is headed by the name of the applied stereotype in guillemets.
Stereotype Computer applied with tag values in compartment
Tag values could be shown in attached comment under stereotype name.
Stereotype Computer applied with tag values in comment note
When displayed in compartments or in a comment symbol, each name-value pair should appear on a separate line.
Source: https://www.uml-diagrams.org/stereotype.html
Posted by: piwetzphebeoes.blogspot.com
Posting Komentar untuk "Uml Stereotypes In Sequence Diagram"