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.TemplateMethodModelTemplate model that enables template writer to skip first occurence of a given argument.Example:
<#if condition> $skip('AND') something </#if> $skip('AND') something moreThe 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:
<#if condition> $skip('AND', 'scope1') something </#if> $skip('AND', 'scope1') something more OR <#if another condition> $skip('AND', 'scope2') something else </#if> $skip('AND', 'scope2') more something elseThis 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
-
-
Constructor Summary
Constructors Constructor Description SkipFirstMethodModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectexec(java.util.List arguments)voidreset()
-