Execute Rules

/*
   * Access the "greeting" rule attribute on the rule object -
   * the result must be cast to the expected type (String)
   */
   final String greeting =
   (String) helloWorld.getAttributeValue("greeting")
   .getValue();

This line retrieves the value of the "greeting" attribute from the rule object created above.

When the attribute's value is requested, CER executes the rules for deriving the attribute's value (in this case, returning the constant string "Hello, world!").

Note: When running an interpreted session, you must cast the output of getValue to the expected data type.

In this example, we have just requested the value of one attribute; however, whilst the Session is still active, code can request the value of any attribute on any rule object in the session. CER remembers values already calculated and only takes the hit of performing a calculation the first time it is requested.