If your business has a specific domain, you can use UML profiles to create new model elements. These elements are derived from your existing model elements, but have attributes specific to your business domain. UML profiles enable you to customize the language in your business object model to fit a specific business domain.
- A stereotype can be applied to all business objects in the business object model, including packages, classes, properties, primitive types, operations, generalizations, and associations.
- A stereotype is displayed as a name surrounded by dots and placed above the name of another business object.
Thus, stereotypes allow you to increase the vocabulary of UML. You can add, create new model elements, derived from existing ones, but with specific properties appropriate to your problem domain. stereotypes are used to introduce new artifacts that use the language of your domain and look primitive. It allows you to introduce new graphical symbols.
When modeling a network, you might need to have notations for <<routers>>, <<switches>>, <<hubs>>, etc. A stereotype allows you to make these things appear as primitive.
Java Bean Profile Diagram using Stereotypes
In this example, we can see that a stereotype can extend from one or more metaclasses. This extension relationship is depicted as an arrow with a continuous line and filled arrowhead. The arrow points away from the stereotype to the metaclass.
In the figure below, we define a profile of EJB as a package. The bean itself is extended from component metamodel as an abstract bean. The abstract bean can be concreted as either an Entity Bean or Session Bean. An EJB has two types of remote and home interfaces. An EJB also contains a special kind of artifact called JAR file for storing a collection of Java code.
Textual vs Graphic Icon Stereotype
Stereotypes can be in textual or graphical representation. The icon can also replace the normal class box. For Example: People often use these 3 stereotyped class representations to model the software MVC framework:
Other Popular Usages for UML profiles
Every technical target, i.e. programming language, middleware, library or database is a natural candidate for defining UML profile. For examples:
- C++ or JAVA
- ORACLE or MYSQL