freemarker.template.instruction
Interface TemplateFunctionModel

All Superinterfaces:
TemplateModel
All Known Implementing Classes:
FunctionModel

public interface TemplateFunctionModel
extends TemplateModel

Functions in a template data model must implement this interface. Performs a function on the given data model, and writes output to the given writer. Any errors are handled using the given TemplateRuntimeHandler. The supplied argument values list may be used as parameters to the function call.

For experts only
This model is similar in principle to the TemplateTransformModel and TemplateTransformModel2 interfaces. The key differences in using this model are:

This makes this model very powerful, in many ways similar to an EmptyInstruction element. In particular, having access to the global data model gives you more than enough rope to hang yourself with. For this reason, only use this model if your only other option would be to create a new FM-Classic tag. Normally either a TemplateTransformModel and/or a TemplateMethodModel2 model would be sufficient.

Note: this model is likely to change in future releases of FM-Classic.

Since:
1.9
Version:
$Id: TemplateFunctionModel.java 1067 2011-06-06 10:55:28Z run2000 $

Method Summary
 void callFunction(TemplateWriteableHashModel modelRoot, java.io.Writer out, TemplateRuntimeHandler eventHandler, java.util.List<TemplateModel> argValues)
          Performs a function on the given data model.
 
Methods inherited from interface freemarker.template.TemplateModel
isEmpty
 

Method Detail

callFunction

void callFunction(TemplateWriteableHashModel modelRoot,
                  java.io.Writer out,
                  TemplateRuntimeHandler eventHandler,
                  java.util.List<TemplateModel> argValues)
                  throws java.io.IOException,
                         TemplateModelException
Performs a function on the given data model.

Parameters:
modelRoot - the template model root, provides full access to the data model
out - the Writer to which output should be sent
eventHandler - handles any events such as template exceptions
argValues - a List of TemplateModels representing the arguments to the function
Throws:
java.io.IOException
TemplateModelException