Specifying stereotypes and constraints for custom UML profiles
After you create a custom UML profile project or add a profile
to an existing project, you must create the stereotypes and constraints that
you want to include in that profile.
Adding stereotypes to custom UML profiles
You can create stereotypes to include in a custom UML profile. When you apply a profile to a model, you can use the stereotypes of the profile to mark up the model for a particular domain or platform.
Associating stereotypes with UML model elements
You can specify the types of model elements that a stereotype extends. When you apply a profile to a model, you can only apply the stereotypes that are applicable to the types of model element that the stereotypes extend.
Specifying icons and graphics for UML stereotypes
You can specify an icon and a graphic to identify each stereotype that you create. When you apply the stereotype to a model element, the specified icon is displayed beside the stereotype name and the specified graphic replaces the default graphic for a diagram element in the diagram editor. GIF or JPG files are the recommended file formats for stereotype icons and SVG is the recommended file format for diagram editor graphics.
Adding attributes to UML stereotypes
In UML models, attributes represent information, data, or properties. You can add attributes to UML stereotypes. You can also specify the data type of attributes.
Adding constraints to custom UML profiles
You can specify constraints within a stereotype in a
custom UML profile. When you define Object Constraint Language (OCL)
constraints, the constraints are validated syntactically. However, Java™ constraints
are not validated syntactically. When you apply a stereotype to
a model element, the attributes of the stereotype are added to the
model element. Stereotype constraints apply to the attributes of
the model element to which the sterotype is applied. The model validation
process checks model element attributes for compliance with stereotype
constraints. If you specify a value for the attribute that does
not comply with the constraint, an error is displayed in the Problems view.
Adding enumerations to custom UML profiles
In UML models, enumerations are model elements that represent user-defined data types. Enumerations contain sets of named identifiers, called enumeration literals, that represent the values of the enumeration. Enumerations can represent primitive types, such as integer and Boolean types, or user-defined types. In a profile, you can specify an enumeration as the type for an attribute. For example, you can specify an enumeration called Days and an enumeration literal for each day of the week. You can then create an attribute called MyFavoriteDay of type Days and specify the enumeration literal called Saturday as the default value for the attribute.