Customizing Generation with GTL

The PowerDesigner Generation Template Language (GTL) is a template-based language, which is used to generate text for the metaclasses defined in the PowerDesigner metamodel, and on any extensions that are defined in the model profile.

Each template is associated with a given metaclass (such as a CDM entity attribute, a PDM table, or an OOM operation). You can define as many templates as you want for each metaclass, and they will be available to all objects (instances) of the metaclass. For example, to examine the set of templates used to generate code for operations in a Java OOM, open the Java object language in the resource editor and expand the Profile\Operation\Templates category.

When you generate a model, PowerDesigner evaluates which metaclasses must have files generated, and creates a file for each instance of the metaclass, by applying the appropriate templates and resolving any variables.

GTL is object-oriented, and supports inheritance and polymorphism for reusability and maintainability. Macros provide generic programming structures for testing variables and iterating through collections, etc.

A GTL template can contain text, macros, and variables, and can reference:

GTL templates can be either: