Class ListDirective
java.lang.Object
ch.tocco.nice2.templating.impl.freemarker.directives.ListDirective
- All Implemented Interfaces:
Nice2TemplateDirective, freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel
A directive that iterates over a
TemplateSequenceModel.
It contains special handling for EntityListSequenceModel:
If the EntityList contains more than DEFAULT_BATCH_SIZE entities, a MemoryEfficientLazyEntityList is used
that creates a new Context for each batch.
Note: The input should to be a type of EntityList that can provide the keys without loading all entities,
like a LazyEntityList (which is for example provided by GroupByMethod, OrderByMethod or QueryDirective).
All other TemplateSequenceModel are handled normally.
The following parameters are available:
- 'source': The TemplateSequenceModel that should be iterated (required)
- 'var': The name of the loop variable (default: 'entity')
- 'batchSize': Number of entities after which a new context is created (default: 50, applies to
EntityListSequenceModel only)-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ListDirective
-
-
Method Details
-
execute
public void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) throws freemarker.template.TemplateException, IOException - Specified by:
executein interfacefreemarker.template.TemplateDirectiveModel- Throws:
freemarker.template.TemplateExceptionIOException
-