
Metamodel user guide
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.

Attribute | Description |
---|---|
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. |
Association | Description |
---|---|
ConstrainedElement : ModelElement [0..*] |