Metamodel user guide
A condition or restriction expressed in natural language text or in a machine readable language, for the purposes of declaring some of the semantics of an element.
Constraints can express restrictions and relationships that cannot be expressed using UML notation. They are particularly useful for stating global conditions or conditions that affect a number of elements. Constraints can have predefined names, and can also represent pre-conditions, post-conditions and invariants (pre-defined stereotypes). The language specific MDACs (C++, Java) add a specific stereotype for the pre-conditions, post-conditions and invariants expressed in these languages, such as, for example, C++Invariant or JavaPreCondition. In Modelio, a Constraint is not made up of anything. It is only managed by specific copy/transfer rules.
Figure 207 : Constraint
|string BaseClass [0..1]|
MetaClass whose instances can be constrained by the current Constraint.
|string Body [0..1]|
If the Constraint is not predefined (for example, ordered), then it is expressed in the body. Modelio supports natural language. For every generator (C++, Java) some constraints have a dedicated stereotype (JavaPrecondition, C++Invariant), and are taken into account during code generation.
|ConstrainedElement : ModelElement [0..*]|