Class SkipFirstMethodModel

java.lang.Object
org.gorpipe.querydialogs.templating.SkipFirstMethodModel
All Implemented Interfaces:
freemarker.template.TemplateMethodModel, freemarker.template.TemplateModel

public class SkipFirstMethodModel
extends java.lang.Object
implements freemarker.template.TemplateMethodModel
Template model that enables template writer to skip first occurence of a given argument.

Example:

The first time the method is called, nothing is output, the next call will output 'AND' (without quotes). In this case that means that 'AND' will only be output if the condition is true, resulting in either: "something AND something more" or just "something more".

Calls to skip can optionally be scoped to provide more control. Example:

This effectively separates concerns for the first two calls and the last two calls, resulting in the possible outcomes:

  • something AND something more OR something else AND more something else
  • something more OR something else AND more something else
  • something AND something more OR more something else
  • something more OR more something else
  • Field Summary

    Fields inherited from interface freemarker.template.TemplateModel

    NOTHING
  • Constructor Summary

    Constructors 
    Constructor Description
    SkipFirstMethodModel()  
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object exec​(java.util.List arguments)  
    void reset()  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • exec

      public java.lang.Object exec​(java.util.List arguments) throws freemarker.template.TemplateModelException
      Specified by:
      exec in interface freemarker.template.TemplateMethodModel
      Throws:
      freemarker.template.TemplateModelException
    • reset

      public void reset()