null

Dieser Ausdruck gibt einen konstanten Wert null an.

Das Festlegen eines Wertes mit null kann hilfreich sein, um anzugeben, dass kein Wert gilt.

<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_null"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">
  <Class name="Pet">
    <Initialization>
      <Attribute name="name">
        <type>
          <javaclass name="String"/>
        </type>
      </Attribute>
    </Initialization>

  </Class>

  <Class name="Person">

    <!-- This Person's favorite Pet, or
         null if the Person owns no pet. -->
    <Attribute name="favoritePet">
      <type>
        <ruleclass name="Pet"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <!-- The name of this Person's
         favorite Pet, or null if
         the Person owns no pet.

         We have to test for the favoritePet
         being null before performing the
         (simple) calculation.-->
    <Attribute name="favoritePetsName">
      <type>
        <javaclass name="String"/>
      </type>
      <derivation>
        <choose>
          <type>
            <javaclass name="String"/>
          </type>
          <when>
            <!-- if this Person has no
                 favorite pet, then calculate the
                 name of the favorite pet as null. -->
            <condition>
              <equals>
                <reference attribute="favoritePet"/>
                <null/>
              </equals>
            </condition>
            <value>
              <null/>
            </value>
          </when>
          <otherwise>
            <value>
              <!-- get the name of the favorite pet -->
              <reference attribute="name">
                <reference attribute="favoritePet"/>
              </reference>
            </value>
          </otherwise>
        </choose>

      </derivation>
    </Attribute>

  </Class>

</RuleSet>