freemarker.template.instruction
Class IncludeInstruction

java.lang.Object
  |
  +--freemarker.template.instruction.EmptyInstruction
        |
        +--freemarker.template.instruction.IncludeInstruction
All Implemented Interfaces:
Instruction, java.io.Serializable, TemplateProcessor

public final class IncludeInstruction
extends EmptyInstruction
implements java.io.Serializable

An instruction that gets another template from a Cache, and processes it within the current template.

Version:
$Id: IncludeInstruction.java,v 1.26 2003/11/28 01:22:24 run2000 Exp $
See Also:
Serialized Form

Fields inherited from interface freemarker.template.instruction.Instruction
BREAK, CASE, COMMENT_END, COMPRESS_END, DEFAULT, ELSE, ELSEIF, FOREACH_END, FUNCTION_END, IF_END, LIST_END, NONE, NOPARSE_END, SWITCH_END, TRANSFORM_END
 
Constructor Summary
IncludeInstruction(TemplateProcessor template, Expression name)
          Constructor that takes the originating template and the name of the template to be included.
IncludeInstruction(TemplateProcessor template, Expression name, Expression type)
          Constructor that takes the originating template, the name of the template to be included and the type of template.
 
Method Summary
 void process(TemplateModelRoot modelRoot, java.io.Writer out, TemplateRuntimeHandler eventHandler)
          Evaluate the template being included by this instruction.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class freemarker.template.instruction.EmptyInstruction
callBuilder, getEndType, isEndInstruction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IncludeInstruction

public IncludeInstruction(TemplateProcessor template,
                          Expression name)
Constructor that takes the originating template and the name of the template to be included.
Parameters:
template - the template that this Include is a part of. Provided so that the instruction can locate a Cache instance.
name - the name, in the TemplateCache, of the template to be included.
Throws:
NullPointerException - template or template name are null
java.lang.IllegalArgumentException - template name is not a string or number

IncludeInstruction

public IncludeInstruction(TemplateProcessor template,
                          Expression name,
                          Expression type)
Constructor that takes the originating template, the name of the template to be included and the type of template.
Parameters:
template - the template that this Include is a part of.
name - the name, in the TemplateCache, of the template to be included.
type - the type of the template, as known by the TemplateRegistry, or null
Throws:
NullPointerException - template or template name are null
java.lang.IllegalArgumentException - template name is not a string or number, or template type is not null, a string, or a number
Method Detail

process

public void process(TemplateModelRoot modelRoot,
                    java.io.Writer out,
                    TemplateRuntimeHandler eventHandler)
             throws java.io.IOException
Evaluate the template being included by this instruction.
Parameters:
modelRoot - 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.

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