Package ilog.rules.bom

Contains the interfaces that are used for representing BOMs and XOMs.

See: Description

Package ilog.rules.bom Description

Contains the interfaces that are used for representing BOMs and XOMs. The main interface in this package is the IlrObjectModel interface.

This package provides a set of interfaces to access model information. The ilog.rules.bom.mutable package provides interfaces to create and change an object model. An implementation is in the ilog.rules.bom.dynamic package. The ilog.rules.bom.serializer package contains the classes to support the object model serialization.

The entry point is the IlrObjectModel interface, the instances of which contain packages (see interface IlrPackage), classes (see interface IlrClass), enumerations (see interface IlrEnum) and primitive types (see interface IlrPrimitiveType).

Here is a sketch of the different ways by which an object model may be defined:

  • To create classes and members see the factory and mutable package or the the implementation package.
  • By reading the object model definition from a file, which uses either a Java-like syntax or an XML syntax. The following example assumes that the Java-like syntax is used:
    
       Reader reader = new InputStreamReader(System.in);
       IlrDynamicObjectModel bom = (new IlrJavaSerializer()).readObjectModel(reader);
    
  • By combining two object model definitions:
    
       IlrDynamicObjectModel bom1 = ...;
       IlrObjectModel bom2 = ...;
       bom1.merge(bom2);
    
Once an object model has been defined it may be saved to an output stream as shown in the following code extract:

   IlrObjectModel bom = ...;
   Writer writer = new OutputStreamWriter(System.out);
   (new IlrJavaSerializer()).writeObjectModel(bom, reader);

Note that if the object model may contain classes bound to actual Java classes (see method mapJavaClass) then it is recommended to limit the extent of the serialization to dynamic classes as in the following code fragment:


   IlrObjectModel bom = ...;
   Writer writer = new OutputStreamWriter(System.out);
   (new IlrJavaSerializer()).writeObjectModel(bom,
                                              writer,
                                              null,
                                              IlrSelectors.dynamicTypes(bom));
Rule Designer API

© Copyright IBM Corp. 1987, 2017