Check

Check

Xpand also provides a language to specify constraints that the model has to fulfill in order to be correct. This language is very easy to understand and use. Basically, it is built around the expression syntax that has been discussed in detail in the previous section. Constraints specified in the Check language have to be stored in files with the file extension .chk . Furthermore, these files have to be on the Java classpath, of course, in order to be found. Let us look at an example, in order to understand what these constraints look like and what they do:

import data;
context Attribute ERROR
  "Names have to be more than one character long." :
  name.length > 1;

Now, let us look at the example line by line:

Important

Please always keep in mind that the message that is associated with the constraint is printed, if the condition of the constraint is false! Thus, if the specified constraint condition is true, nothing will be printed out and the constraint will be fulfilled.

The workflow component org.eclipse.xtend.check.CheckComponent allows to integrate model validation constraints using the Check into a modeling workflow using MWE.

This component provides the following configuration properties: