Defining a default value for a property

You define a default value for a property in an extension model file and then specify the default values in an extension data file.

About this task

To define a default value for a property, you specify the default value in an extension data file.

Note:

You can define a default value only on primitive type properties.

Procedure

To define a default value for a property:

  1. Create or open an extension data file.
  2. In the Rule Model Extension Editor, right-click the extension data entry and then click New Child  > Property Data.

    The tree displays a new Property Data item.

  3. Select the Property Data item and, in the Properties view, set these properties:
    1. Set the Name property to the name of the property to which you want to attach a default value.
    2. Set the Default Value property to a default value of the appropriate type.
  4. Save the extension data file.

Results

You have now defined a default value for a property.

Example

In XML, you create a default value for a property as follows:
  1. In the extension model file:
    <class name="MyRule" extends="ActionRule">
      <property name="score" type="Integer"/>
    </class>
    
  2. In the extension data file:
    <property-data name="score" defaultValue="10"/>