Templates and Generated Files (Profile)

You can define templates and generated files for metaclasses, stereotypes, and criteria. If a template applies to all metaclasses, then you should create it in the Shared category.

The PowerDesigner Generation Template Language (GTL) is used to generate files from metaclasses and for scripting (see Customizing Generation with GTL). You write a template in GTL, using variables that allow you to access properties of the current object or any other object in the model.

In the following example, the Generated Files category for classifiers contains a Java Source entry, which contains a reference to the template %source%. When the file is generated for a given classifier or for the instances of a classifier with a selected stereotype or criterion, it will have the name specified in the File name field, and will contain the contents generated by this template:



Note: If you position your cursor between the percent signs surrounding this or any other template name and press F12, you will either jump directly to the referenced template or, if several templates share the same name, a Results diaglog will open allowing you to select the template you want to navigate to.
The referenced template, source, contains GTL code to generate the contents of the file, including references to other templates called: