Enumerations in Modlr
(Adding message template to the top of the page)
(Updated Edited template to July 12, 2025.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{message|Write the content here to display this box}}
<message>Write the content here to display this box</message>
One weakness we recently rectified was the lack of enumeration definitions inside Modlr. Before, you had to assign an Enumerable type name to an attribute like so:
One weakness we recently rectified was the lack of enumeration definitions inside Modlr. Before, you had to assign an Enumerable type name to an attribute like so:


Line 19: Line 19:
[[Category:MDriven Designer]]
[[Category:MDriven Designer]]
[[Category:OCL]]
[[Category:OCL]]
{{Edited|July|12|2024}}
{{Edited|July|12|2025}}

Latest revision as of 05:49, 20 January 2025

This page was created by Alexandra on 2018-10-24. Last edited by Edgar on 2025-01-20.

One weakness we recently rectified was the lack of enumeration definitions inside Modlr. Before, you had to assign an Enumerable type name to an attribute like so:

Enumerations -1.png

Then accept that Modlr treated your attribute of type string and not as an Enumerable:

Enumerations -2 .png

This was simply because the Model was not informed about the Enumeration. In fact, you had to define the Enumeration at some place in the code yourself to get the CodeGen to use it.

Now, you can get up this dialog (add model elements, edit Enumerations):

Enumerations -3.png

Here, declare the enumeration name, values, and code comments (and also the optional integer value).

If the CodeGen checkbox is checked, we will add the Enumeration to your code. The important thing here is that the model has been made more detailed by keeping the knowledge about Enumerations inside the model so that we can use the Enumeration values in constraints, ViewModel validations, etc.