Example: Setting Default Property Values

You can set a default value for most object properties via an Initialize event handler.

  1. Add the appropriate metaclass to your profile (see Metaclasses (Profile)), and create an event handler of type Initialize under it.
  2. Click the Event Handler Script tab and modify the script to specify default values for one or more properties in the form:
     obj.PropertyName = Value
    For example, the following script sets the stereotype of a CDM inheritance to MyInheritance and its Generate children property to the value of Inherit only primary attributes:
    Function %Initialize%(obj)
        obj.Stereotype = "MyInheritance"
        obj.InheritAll = False
        %Initialize% = True
    End Function
  3. Click OK to save your changes and close the resource editor.
    From now on, when you create an inheritance in your model, these properties will be set to the specified default values.