ILOG JRules User Guide > Creating Rule Projects > Tasks > Defining How Business Elements Map to the XOM > Mapping Classes > Adding Tests to Filter Out Class Instances

As the mapping from a business class to an execution class may become more complex (for example several business classes may be mapped to one execution class), you may need to specify a tester to test the instances of the execution class.

To add a tester to the class mapping using IRL mapping:

  1. In the Outline view, click the class to which you want to add a tester.
  2. In the BOM Editor, in the BOM to XOM Mapping section, type an IRL statement that returns a Boolean value in the Tester field. Use this to represent the current object.
  3. Save the BOM.
  4. The tester is now applied to the class mapping.

For example, if there is a business class called RichCustomer in your BOM, corresponding to an execution class Customer with the attribute money greater than 100000:

return this.money > 100000;

Extender mapping can be used to add a tester to class mapping.

To add a tester to the class mapping using extender mapping:

  1. In the Outline view, click the class to which you want to add a tester.
  2. In the BOM Editor, in the BOM to XOM Mapping section, specify the name of your extender class in the Extender name field.
  3. Define the tester as an extender method. The extender method must be a static method of the extender class named tester returning a Boolean and taking the execution class as parameter.
  4. Save the BOM.
  5. The tester is now applied to the class mapping.

For example, in the case of the RichCustomer business class corresponding to an execution class Customer:

public static boolean tester(Customer customer) {
  return customer.money > 100000;
}
This specifies that the tester method is a Java static method of the extender class named tester, returning a boolean and taking Customer (the execution class) as its parameter.

Related Concepts

Business Object Model (BOM)
Execution Object Model (XOM)
BOM and XOM

Related Tasks

Mapping Classes

Related Reference

BOM Editor
ILOG Rule Language

Related Samples and Tutorials

Tutorial: Defining a Vocabulary