Method Loops

 

A method loop is a template file construct which allows you to iterate through the collection of methods that CodeGen has information about. These method definitions come from an interface definition in a Synergy Method Catalog.

 

Method loops are delimited by a matching pair of <METHOD_LOOP> and </METHOD_LOOP> tags, which surround the template code to be inserted for each method. The code between the opening and closing tags of an method loop is repeated for each method in the interface catalog being processed. This code may contain other generic and structure tokens, and may also contain special method loop tokens, which are discussed later. Loop utility tokens can also be used in method loops.

 

There are two types of method loop, called multi-line method loops, and in-line method loops.

 

Multi-Line Method Loops

Multi-line method loops occur when the opening and closing method loop tags appear on separate lines in a template file, and delimit one or more entire lines of template code, like this:

[code]

<METHOD_LOOP>
code
</METHOD_LOOP>

[code]

Multi-line method loops generate one or more lines of output code for each method that is processed.

In-Line method Loops

In-line method loops exist when the opening and closing method loop tags appear on the same line in a template file, and delimit part of a line of template code, like this:

[code] <METHOD_LOOP> code </METHOD_LOOP> [code]

In-line method loops generate code into the current output line.

 

 

 


Copyright © 2021  Synergex International, Inc.