xv.text.template
Class TemplateElement

java.lang.Object
  extended by xv.text.template.TemplateElement
Direct Known Subclasses:
ExpansionTemplateElement, StringTemplateElement

public abstract class TemplateElement
extends Object

Base class of elements within the templating system. Each template is made up of one or more elements that are executed to produce the final output.

Author:
xv

Field Summary
protected  TemplateElement nextElement
          The next element in the element list, as added by addChild(TemplateElement).
 
Constructor Summary
TemplateElement()
           
 
Method Summary
 TemplateElement addChild(TemplateElement element)
          Add the given template element as the child.
abstract  TemplateElement execute(TemplateEnvironment environment, Appendable out)
          Execute the current token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextElement

protected TemplateElement nextElement
The next element in the element list, as added by addChild(TemplateElement).

Constructor Detail

TemplateElement

public TemplateElement()
Method Detail

addChild

public TemplateElement addChild(TemplateElement element)
Add the given template element as the child.

Parameters:
element - the element to add
Returns:
the new "current element" for the parser

execute

public abstract TemplateElement execute(TemplateEnvironment environment,
                                        Appendable out)
                                 throws TemplateException,
                                        IOException
Execute the current token.

Parameters:
environment - the environment to use
out - the appendable to write the generated text to
Returns:
the next template element to execute, or null to end the template execution - generally subclasses should just return nextElement unless they implement some sort of flow control
Throws:
TemplateException - if an error occurs within the templating system
IOException - if an I/O error occurs - this should never be thrown by an implementation directly, solely by the Appendable being written to


Copyright © 2008-2011. All Rights Reserved.