GTL Variable Reference

Variables are qualified values enclosed in % characters and optionally preceded by formatting options. At evaluation-time, they are substituted by their corresponding value in the active translation scope.

A variable can be of the following types:

For example, the variable %Name% of an interface can be directly evaluated by a macro and replaced by the name of the interface in the generated file.

Note: Be careful when using variable names as they are case sensitive. The variable name must have the first letter with an upper case, as in %Code%.

Variables Syntax

The following variables are shown with their possible syntaxes:

variable-block:

%[.formatting-options:]variable%

variable

[outer-scope.][variable-object.][object-scope.]object-member
[outer-scope.][variable-object.][collection-scope.]collection-member
[outer-scope.]local-variable
[outer-scope.]global-variable

object-member:

volatile-attribute
property
[target-code::]extended-attribute
[target-code::][metaclass-name::]template-name[(parameter-list)]
[*]+local-value[(parameter-list)]

object-member-object =

objecttype-property
oid-valued-object-member
this

collection-member

First
IsEmpty
Count

collection-member-object =

First

local-variable

local-object
[*]local-value

global-variable

global-object
global-value
$environment variable

variable-object

global-object
local-object

outer-scope

[outer-scope.]Outer

object-scope

[object-scope.]object-member-object
collection-scope.collection-member-object

collection-scope

[object-scope.]collection
[object-scope.]semi-colon-terminated-oid-valued object-member

For more information on extended collections, see Extended Collections and Compositions (Profile).