Chapter 9 Generation Reference Guide (GTL)


Introduction to the Generation Template Language

The PowerDesigner Generation Template Language (GTL) is a template-based language for text generation. You can use GTL to generate pieces of text for any metaclass (object type) in a model, in order to generate code or reports, or to produce external formats, such as XMI.

A GTL template contains plain text and variables that resolve to information extracted from the model, such as the name of a class or data type of an attribute, or a collection of objects, such as the list of attributes of a class. You can also test variables and control their formatting.

When you generate a model, PowerDesigner evaluates which metaclasses must have files generated, and creates one file for each object that belongs to this metaclass, by applying the appropriate templates and resolving any variables.

GTL operates on the metaclasses defined in the PowerDesigner metamodel (see the "Resource Files and the Public Metamodel" chapter), and on any extensions that are defined in the model profile (see the "Managing Profiles" chapter).

GTL is object-oriented, and supports inheritance and polymorphism for reusability and maintainability. Macros provide generic programming structures for testing variables (example: .if), and for iterating through the dependent items of an object (example: .foreach.). Conditional, iterative and text formatting macros are also available.

In this chapter, most examples proceed from the Java language. However, the mechanism explained in this section also applies to all object languages and all extended model definitions.

 


Copyright (C) 2007. Sybase Inc. All rights reserved.