|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.instruction.GenericStartInstruction
freemarker.template.instruction.FunctionInstruction
public final class FunctionInstruction
An instruction representing a function definition. Function calls are
represented by the CallInstruction class.
Unlike other instructions, FunctionInstruction is not added
directly to the TemplateProcessor chain. Instead,
instances are added directly to the template using the
FunctionTemplateProcessor.addFunction(java.lang.String, freemarker.template.instruction.TemplateFunctionModel) method. At
run time, these functions can be added to the data model for speedy lookup.
At compile time, instances of FunctionInstruction are replaced
by NOOPInstruction, so that the
TemplateProcessor tree doesn't have to deal with
null values.
| Field Summary |
|---|
| Fields inherited from class freemarker.template.instruction.GenericStartInstruction |
|---|
body |
| Fields inherited from interface freemarker.template.instruction.Instruction |
|---|
ASSIGN_END, BREAK, CASE, COMMENT_END, COMPRESS_END, DEFAULT, ELSE, ELSEIF, FOREACH_END, FUNCTION_END, IF_END, LIST_END, NONE, NOPARSE_END, SWITCH_END, TRANSFORM_END |
| Fields inherited from interface freemarker.template.TemplateProcessor |
|---|
BREAK, EXIT, OK, UNCOMPILED_TEMPLATE |
| Constructor Summary | |
|---|---|
FunctionInstruction(Identifier name,
java.util.List arguments)
Constructor for a function definition. |
|
FunctionInstruction(Identifier name,
java.util.List arguments,
boolean localScope)
Constructor for a function definition. |
|
| Method Summary | |
|---|---|
TemplateProcessor |
callBuilder(TemplateBuilder builder)
Call the TemplateBuilder with this
function instruction. |
java.util.List |
getArgumentNames()
Retrieve a list of argument names. |
java.lang.String |
getName()
Retrieve the function name. |
boolean |
isLocalScope()
Is this function declared with global or local scope. |
short |
process(TemplateWriteableHashModel modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler)
Processes the contents of this <function ... |
boolean |
testEndInstruction(Instruction endInstruction)
Is this the right kind of instruction for the given EndInstruction? |
java.lang.String |
toString()
Returns a string representation of the object. |
| Methods inherited from class freemarker.template.instruction.GenericStartInstruction |
|---|
getEndType, isEndInstruction, setBody |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FunctionInstruction(Identifier name,
java.util.List arguments)
name - the name of the functionarguments - a List of Identifiers containing the names of each of the
arguments
java.lang.NullPointerException - the name or argument list is null
public FunctionInstruction(Identifier name,
java.util.List arguments,
boolean localScope)
name - the name of the functionarguments - a List of Identifiers containing the names of each of the
arguments
java.lang.NullPointerException - the name or argument list is null| Method Detail |
|---|
public java.lang.String getName()
public java.util.List getArgumentNames()
public boolean testEndInstruction(Instruction endInstruction)
EndInstruction?
testEndInstruction in interface ContainerInstructionendInstruction - the end instruction we're testing
true if the EndInstruction is a
function end instruction, otherwise false
public TemplateProcessor callBuilder(TemplateBuilder builder)
throws ParseException
TemplateBuilder with this
function instruction.
callBuilder in interface InstructioncallBuilder in class GenericStartInstructionbuilder - the TemplateBuilder to be called back
ParseException
public short process(TemplateWriteableHashModel modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler)
throws java.io.IOException
<function ... > and
outputs the resulting text to a Writer.
Todo: RootModelWrapper should probably be handled by FunctionModel.
process in interface TemplateProcessormodelRoot - the root node of the data model.out - a Writer to send the output to.eventHandler - a TemplateEventAdapter for handling any events
that occur during processing.
java.io.IOException - an IO error occurred during processingpublic boolean isLocalScope()
true if this function is declared in local scope,
otherwise falsepublic java.lang.String toString()
toString in class java.lang.ObjectString representing this instruction subtree
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||