freemarker.template.instruction
Class FunctionModel
java.lang.Object
|
+--freemarker.template.instruction.FunctionModel
- All Implemented Interfaces:
- java.io.Serializable, TemplateModel
- public final class FunctionModel
- extends java.lang.Object
- implements TemplateModel, java.io.Serializable
An immutable TemplateModel
wrapper for
a FunctionInstruction
s. This approach allows us to add functions
to the data model, while still enforcing the restriction that every
element of the data model should implement the
TemplateModel
interface.
Notably, this class is a direct subclass of
TemplateModel
, rather than going through an
intermediate interface.
- Version:
- $Id: FunctionModel.java,v 1.19 2003/11/27 11:36:45 run2000 Exp $
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FunctionModel
public FunctionModel(FunctionInstruction function)
- Constructor for the function model.
- Parameters:
function
- the function to be stored in the model- Throws:
NullPointerException
- the function is null
isEmpty
public boolean isEmpty()
- Is the function model populated?
- Specified by:
isEmpty
in interface TemplateModel
- Returns:
true
if there is no function instruction
associated with the model, otherwise false
callFunction
public void callFunction(TemplateModelRoot modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler,
java.util.List argValues)
throws java.io.IOException
- Calls the specified
FunctionInstruction
.
- Parameters:
modelRoot
- the root of the template modelout
- the output stream to send the resultseventHandler
- handler for any events firedargValues
- the arguments passed to the function- Throws:
java.io.IOException
- there was an IO error writing the results
toString
public java.lang.String toString()
- Returns a string representation of the object.
- Overrides:
toString
in class java.lang.Object
- Returns:
- a
String
representing this instruction subtree