Chapter 9 Generation Reference Guide (GTL)


Using recursive templates

A recursive template is a template that is defined in terms of itself.

Example

Consider three classes X, Y, and Z. X is inner to Y, and Y is inner to Z.

The variable %topContainerCode% is defined to retrieve the value of the parent container of a class.

The value of the template is the following:

.if (%isInner%)
%ContainerClassifier.topContainerCode%
.else
%Code%
.endif

If the class is inner to another class, %topContainerCode% is applied to the container class of the current class (%ContainerClassifier.topContainerCode%).

If the class is not an inner class, the code of the class is generated.

 


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