Enumerations in Modlr
(Created page with "One weakness that we recently rectified was the lack of enumeration definitions inside Modlr. Before you have to just assign an Enumerable type name to an attribute like so:...")
 
(Replacing message template with parser tag)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
One weakness that we recently rectified was the lack of enumeration definitions inside Modlr. Before you have to just assign an Enumerable type name to an attribute like so:
<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:


[[File:Enumerations -1.png|frameless|213x213px]]
[[File:Enumerations -1.png|frameless|213x213px]]


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


[[File:Enumerations -2 .png|frameless|456x456px]]
[[File:Enumerations -2 .png|frameless|456x456px]]


This was simple because the Model was not informed about the Enumeration. In fact you had to define the enumeration some place in code yourself to get the CodeGen to use it.
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.


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


[[File:Enumerations -3.png|frameless|476x476px]]
[[File:Enumerations -3.png|frameless|476x476px]]


And in here you declare the enumeration name, values and code comments (and also the optional integer value).
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.
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.
[[Category:MDriven Designer]]
[[Category:OCL]]
{{Edited|July|12|2024}}

Latest revision as of 07:42, 17 June 2024

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.

This page was edited 95 days ago on 06/17/2024. What links here