[#package packageName]



The package directive defines the namespace of text templates and of scripts. Related text templates are grouped into packages to be easier to find and use, to avoid naming conflicts, and to control access. A package may contain text templates, rulesets, scripts and Java types.

The qualified name of the package must match the folders in which the file is defined: a com.mycompany.example package declaration may be used in the folder com/mycompany/example.

This is the first directive that must appear in an TGL file. Any other statement is defined after this directive.


A text template example:

[#package com.mycompany.example]

[#template myTemplate()]
some text to generate

A script example:

[#package com.mycompany.example]

[#metatype uml21.Class]

[#script public myScript]
some text to generate