How do I set attribute length in Modelio?

1.5k views Asked by At

I have been working with Modelio for a few weeks and I want to limit the lenghts of the data types I use, like the "string" type when I work with a Class Diagram. I want to be able to specify something in the trend of "string min(5) max(128)" or limit the value that can be entered for an integer field, so when I export the XMI file and create my database, that contstraint is included.

I tried with constraints, but the documenation does not give any examples, but only shows you screen shots of where to find the constraints dialog.

How do set I set length of attributes in Modelio?

1

There are 1 answers

3
Red Beard On

In order to constraint an attribut, I see two ways:

  1. Use the multiplicities min and max. For example, your "string min(5) max (128)" could be see a char array with a 5 as minimum multiplicity and 128 as maximum multiplicity
  2. Use UML Constraint. UMl do not oblidge you to use a language or another so you can use English, C++0 or OCL (Object Constraint Language), it is up to you. I made a screenshot of a constraint which says that the value of the attribut constrainedInt must be lower than 128. BTW my OCL could be a little rustied... but the principle is there.

enter image description here