Class LoadValueDirective

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

public class LoadValueDirective extends Object implements Nice2TemplateDirective, TemplateIdentifiers
Directive for FreemarkerEngine to load a value from an entity within a template.

Parameters available in template:

  • entity (optional): the reference entity, if not specified the entity stored in baseData is loaded
  • path (required): a path to a field to follow from the entity
  • name (optional): a variable name to store the value (value is not written to output in this case)
  • pattern (optional): a pattern (as in DateTimeFormatter) to format a date (ignored when accessed field is not a date
  • delimiter (optional): a delimiter to split the value
  • lineStart (optional): a string which will be placed at the start of a new line (in combination with delimiter)
  • lineEnd (optional): a string which will be placed at the end of a new line (in combination with delimiter)
  • Constructor Details

    • LoadValueDirective

      public LoadValueDirective(org.slf4j.Logger log)
  • 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