Execution of Code Templates

Return to Introduction  Previous page  Next page

A reference to a template (such as the %ClassNotes% macro, from our previous example) results in the execution of that template.

Each template is designed for use with a particular element. For example the ClassNotes template is to be used with UML Class elements.

The element that is currently being generated is said to be in scope. If the element in scope is stereotyped Enterprise Architect looks for a template that has been defined for that stereotype. If a match is found, the specialized template is executed. Otherwise the default implementation of the base template is used.

Templates are processed sequentially, line by line, replacing each macro with its underlying text value from the model.