This function creates an enumeration of the objects passed in the function parameters. The number of parameters may be from zero to unlimited.

Parameters may be any objects. The null parameters are skipped.

When a parameter itself represents an enumeration (i.e. an instance of java.util.Enumeration or java.util.Iterator Java class), all elements contained in it are added to the result enumeration in place of that parameter. At that, the function is optimized so that all elements from the sub-enumeration are obtained dynamically only when they are requested. No intermediate element container is created.

This allows using this function for merging several big enumerations into a single one.

You may also use this function when you need to pass only a few objects to some another function, which is normally intended to process a lot of them provided in the form of enumeration.

Example 1:

The following call creates an empty enumeration:

Enum()
Example 2:

This creates an enumeration of three String objects:

Enum("1","2","3")
Example 3:

The following expression is from a real template:


id = contextElement.id;
Enum (
  contextElement,
  findElementsByKey ("direct-subtypes", id),
  findElementsByKey ("indirect-subtypes", id)
)
This creates an enumeration that starts from the current generator context element followed by the elements obtained from the "direct-subtypes" element map (using the context element's id as a key), by which, follow the elements obtained the same way from the "indirect-subtypes" element map.

(The whole enumeration, actually, was supposed to represent a certain type and all its direct and indirect subtypes, which was needed for further processing).