net.sourceforge.templat
Class Templat

java.lang.Object
  extended by net.sourceforge.templat.Templat

public class Templat
extends Object

TemplAT is a template processor, used in conjunction with Java. Templates contain processing instructions within at-signs, thus the name TemplAT. Processing instructions include if-then-else, loops, includes (with parameters), and (Java) method calls.

Author:
Chris Mosher

Constructor Summary
Templat(URL url)
          Initializes this Templat to read from the given URL.
 
Method Summary
 URL getURL()
          Gets the URL of this Templat (as passed into the constructor).
 void render(Appendable appendTo, Object... rArg)
          Renders this template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Templat

public Templat(URL url)
Initializes this Templat to read from the given URL. The contents of the URL are assumed to be in UTF-8 format.

Parameters:
url - the URL to read the template from (UTF-8)
Method Detail

getURL

public URL getURL()
Gets the URL of this Templat (as passed into the constructor).

Returns:
the URL.

render

public void render(Appendable appendTo,
                   Object... rArg)
            throws TemplateLexingException,
                   TemplateParsingException,
                   IOException
Renders this template. The arguments, if any, are passed to the template itself, and bound to the parameters specified in the template definition. The result of parsing the template is appended to the given Appendable.

Parameters:
appendTo - the Appendable to append the result to
rArg - optional argument(s) to pass to the template
Throws:
TemplateLexingException
TemplateParsingException
IOException