|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.instruction.FunctionModel
public final class FunctionModel
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.
Constructor Summary | |
---|---|
FunctionModel(FunctionInstruction function)
Constructor for the function model. |
Method Summary | |
---|---|
void |
callFunction(TemplateWriteableHashModel modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler,
java.util.List<TemplateModel> argValues)
Calls the specified FunctionInstruction . |
boolean |
isEmpty()
Is the function model populated? |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FunctionModel(FunctionInstruction function)
function
- the function to be stored in the model
java.lang.NullPointerException
- the function is nullMethod Detail |
---|
public boolean isEmpty()
isEmpty
in interface TemplateModel
true
if there is no function instruction
associated with the model, otherwise false
public void callFunction(TemplateWriteableHashModel modelRoot, java.io.Writer out, TemplateRuntimeHandler eventHandler, java.util.List<TemplateModel> argValues) throws java.io.IOException
FunctionInstruction
.
callFunction
in interface TemplateFunctionModel
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
java.io.IOException
- there was an IO error writing the resultspublic java.lang.String toString()
toString
in class java.lang.Object
String
representing this instruction subtree
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |