Package ilog.rules.bom.mutable

Defines the object model mutable API.

This package is composed of a number of interfaces that are the mutable extensions of the ilog.rules.bom interfaces, for example IlrMutableClass is the extension of IlrClass.

This package also contains a factory class, IlrModelFactory that lets you create instances of those mutable interfaces without having to rely on a specific implementation.

Implementations of this package interfaces can be found in the ilog.rules.bom.dynamic package.

Here is a sketch of how to use the interfaces of this package to fill an object model:

  • By importing the definition of actual Java classes. For example:
    
        IlrModelFactory factory = new IlrDynamicModelFactory();
        factory.createClass(mycompany.Account.class);
    
  • By explicit definition using the dynamic object model API:
    
        IlrModelFactory factory = new IlrDynamicModelFactory();
        IlrMutableObjectModel om = factory.getOrCreateModel();
        IlrMutablePackage company = factory.createPackage("company");
        IlrMutableClass employee = factory.createClass(company, "Employee");
        IlrMutableAttribute name = factory.createAttribute(employee, "name");
        name.setAttributeType(om.getStringClass());
        IlrMutableMethod setAssignment = factory.createMethod(employee, "setAssignment");
        factory.createParameter(setAssignment, "assignment", om.getStringClass());
        IlrMutableMethod getAssignment = factory.createMethod(employee, "getAssignment");
        getAssignment.setReturnType(om.getStringClass());
        IlrMutableComponentProperty assignment = factory.createComponentProperty(employee, "assignment");
        assignment.setReadMethod(getAssignment);
        assignment.setWriteMethod(setAssignment);