Creating rules
Overview
It may be necessary to define new generation or filter rules in order to have rules applying to a specific requirement.
The generation and filter rules are in fact simple J methods referenced by document items. However, these J methods have a definition and behavior which are specific to the document template.
In order to avoid overloading the dialog boxes that reference the rules, only the J methods designed for the document template should be displayed. This explains why certain criteria allow you to filter the J methods that are of interest to you.
Filter rule
To make a J method available as a filter rule on a document item, the method must have:
· a String type return parameter
· the {template} tagged value
The methods provided are those corresponding to the criteria previously defined on the document template's UML profile and the parent UML profiles.
Creating new filter rules allows you to filter model elements according to the value of their attributes.
For example, it is possible to create document items that only generate public methods, or string type attributes, ….
Generation rules
To make a J method available as a pre-generation, generation, or post-generation rule on a document item, the method must have:
· a string type return parameter
· the {template} tagged value
The methods provided are those corresponding to the criteria previously defined on the document template's UML profile and parent UML profiles.
Creating new generation rules allows you to generate new information on the model elements according to the value of their attributes. For example, it is possible to create rules that generate the visibility of a method, the type of an attribute ….
Running a template
While generating the document template, the J methods used for the filter rules, and the three types of generation rule are assessed. The method's syntax does not undergo any checks.
Modifying the signature of such a method after it has been referenced by a document item would risk bringing the generation to a sudden stop.