A stereotype is one of three types of extensibility mechanisms in the Unified Modeling Language(UML), the other two being tags and constraints. A stereotype represents a refinement of an existing modeling concept and is defined within a UML profile, which is a collection of related stereotypes, tags, and constraints to specialize the use of the UML for a specific domain or platform, such as a UML profile for project management or for data modeling.
If you find that you need a modeling construct that isn’t in the UML but is similar to something that is, you treat your construct as a stereotype of the UML construct. The UML predefines many stereotypes, such as «destroy» (used on sequence diagrams), and also allows user-defined ones. Thus, stereotypes provide an extension mechanism in the UML and can be summarized as follows:
- 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 extends the vocabulary of the UML, allowing to create new kinds of building blocks that are derived from existing ones but that are specific to the problem. For example, during modeling a network, designers deal with concepts like routers and hubs. By creating stereotypes for them, UML is extended by new building blocks that have special properties, semantics and notation.
- 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.