How to add default to a property in a concept

This post assumes that you have an MPS with mbeddr preloaded.

Go to the constraints aspect for the concept you want to add a default to a property:

hdp-01

Create a new constraint for this concept:

hdp-02

Press Ctrl+L and import the language com.mbeddr.mpsutil.propertydefault:

hdp-03

hdp-04

Go to the property constraints and press Enter to make a new one:

hdp-05

Choose the property to which you want to apply a default value:

hdp-06

Select the entire constraint by pressing ctrl + uparrow twice:

hdp-07

Press Ctrl + Space and choose default to convert the constraint to a default specification:

hdp-08

Choose your default value:

hdp-09

If you now make an instance of MyConcept, you will automatically get the myProperty filled in with the default value:

hdp-10

 

Leave a Comment