java.lang.Object
ch.tocco.nice2.templating.impl.freemarker.directives.ListDirective
All Implemented Interfaces:
Nice2TemplateDirective, freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

public class ListDirective extends Object implements Nice2TemplateDirective
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
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields inherited from interface freemarker.template.TemplateModel

    NOTHING
  • Constructor Summary

    Constructors
    Constructor
    Description
    ListDirective(ContextManager contextManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • 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:
      execute in interface freemarker.template.TemplateDirectiveModel
      Throws:
      freemarker.template.TemplateException
      IOException