Element <generator>¶
Purpose: Register a project-defined generator class under a descriptor-local identifier.
Why: Use it to bind a reusable generator expression to a project-local name.
Example¶
1 | |
Decision guide¶
Business value: Lets several fields or tasks intentionally share one configured generator instance.
-
Use when
- A stateful or expensive generator configuration must be reused by name.
-
Choose another approach when
- Only one field uses the generator or independent instances are desired.
-
Prerequisites
- Select a registered generator and a unique descriptor-local name.
-
Alternatives
- Configure a one-off generator directly on key or id. (See:
<key>)
- Configure a one-off generator directly on key or id. (See:
Complete examples¶
Register and reuse one stateful generator instance
Use a named generator when several fields or tasks must deliberately share one configured generator instance rather than create independent instances.
| named-generator/script/preflight.scr.py | |
|---|---|
1 | |
| named-generator/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 | |
Rules and invalid combinations¶
No additional element-specific rules. Required attributes, types, and supported values are shown below.
Allowed parents / Allowed children¶
Allowed parents: else, else-if, if, setup, while
Allowed children:
None
Attributes¶
Show all 2 attributes
generator
Generator expression to register.
required; string.
name
Name of the generator binding.
required; string.