ILOG JRules User Guide > Creating Rule Projects > Concepts > Business Object Model (BOM) > Collections

Collections are members that are semantically linked to a BOM class with a one-to-many relation. Collections are available in business rules in specific BAL constructs like one of <objects>, and the number of <objects> in <objects>.

For example, the following business rule uses collections:

definition
 set 'company1' to a company;
 set 'customer1' to a customer in the employees of 'company1';
if 
  the number of books in the items of the shopping cart of 'customer1' is more than 5
 ...

Collections are automatically created for members and method arguments that:

public class Company {
   Employee[] getEmployees();
}
public class Company {
   java.util.Collection getEmployees() domain 0, * class Employee;
}
You modify the domain in the BOM editor to define the type of an item contained in a collection specified in the BOM.

A member of type java.util.Collection is not automatically treated as a collection in business rules until you set a collection domain on it.

If the collection domain is not typed, then it is considered as typed to java.lang.Object. For example, in the following BOM class, the attribute employees is considered as a collection of java.lang.Object objects.

public class Company
{
  public java.util.Collection employees domain 0,*;
}

Related Concepts

Business Object Model (BOM)
Domains
Business Elements Originating from a Java XOM

Related Tasks

Creating New Business Elements

Related Reference

BOM Editor

Related Samples and Tutorials

Tutorial: Defining a Vocabulary
How to Populate a BOM Domain from a Data Source