The Generation Template Language (GTL) uses templates to generate files. A template is a piece of code defined on a given PowerDesigner metaclass and the metaclasses that inherit from this class. It can be used in different contexts for text and code generation.
These templates can be considered as metamodel extensions as they are special kinds of metamodel class attributes. You can define as many templates as needed for any given metaclass using the following syntax:
<metamodel-classname> / <template-name>
Templates are inherited by all the descendants of the metaclass they are defined for, and so can be used to share template code between metaclasses with a common ancestor. For example, if you define a template for the BaseObjects abstract class, all the classes linked via generalization links to this class inherit from this template.
The GTL uses macros such as foreach_item, for iterating over object collections. The template specified inside the block is translated over all the objects contained in the specified collection. The metamodel provides useful information about the collections of the metaclass on which you define a template containing an iteration macro.
The following calculated attributes are metamodel extensions specific to GTL:
Metaclass |
Attributes |
---|---|
PdCommon.BaseObject |
|
PdCommon.BaseModel |
|
PdOOM.* |
|
PdOOM.Association |
|
PdOOM.Attribute |
|
PdOOM.Class |
|
PdOOM.Interface |
|
PdOOM.Operation |
|
PdOOM.Parameter |
The following calculated collections are metamodel extensions specific to the GTL: