No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
[[File:Enumerations -1.png|frameless|213x213px]] | [[File:Enumerations -1.png|frameless|213x213px]] | ||
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 simply because the Model was not informed about the Enumeration. In fact, you had to define the | 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): | |||
[[File:Enumerations -3.png|frameless|476x476px]] | [[File:Enumerations -3.png|frameless|476x476px]] | ||
Here, | 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 | 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:MDriven Designer]] | ||
[[Category:OCL]] | [[Category:OCL]] |
Revision as of 05:50, 19 June 2023
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:
Then accept that Modlr treated your attribute of type string and not as an Enumerable:
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):
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.