The core report engine of Rational Publishing Engine, called Rational Reporting for Document Generation (RRDG), is structured to organize data through the use of data models. Data models can help you plan and control how your data is used. In Rational Reporting for Document Generation, some of the API classes might expose details of their internal structure.
The exposure of this internal representation produces two issues:
- When consumers of the class try to operate directly on the structure of the class, the class invariants might break.
- The classes cannot be redesigned and the implementation cannot be modified (to improve performance, for example).
Resolving the problem
When the methods from the classes listed below return a collection of child objects, the collection that is returned cannot be modified. An exception is thrown and you can modify these collections only by adding and removing methods that are defined in the class itself. This ensures that the class invariant holds true and the Rational Reporting for Document Generation client code is also correct.
Feature.getProperties() method returns a collection all the properties of the feature. That collection can be used only to iterate the properties, but not add or remove properties to the feature. To add or remove properties, the accessor methods defined in the Feature class, such as addProperty, addProperties, or removeProperty, must be used. Note that only the collection cannot be modified; the properties themselves can be changed.