Class SkipFirstMethodModel
java.lang.Object
org.gorpipe.querydialogs.templating.SkipFirstMethodModel
- All Implemented Interfaces:
freemarker.template.TemplateMethodModel,freemarker.template.TemplateModel
Template model that enables template writer to skip first occurence of a given argument.
Example:
<#if condition>
$skip('AND') something
</#if>
$skip('AND') something more
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:
<#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 else
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 -
Method Summary
-
Constructor Details
-
SkipFirstMethodModel
public SkipFirstMethodModel()
-
-
Method Details
-
exec
- Specified by:
execin interfacefreemarker.template.TemplateMethodModel- Throws:
freemarker.template.TemplateModelException
-
reset
public void reset()
-