Tmplz Template API

Getting Started

Additional classes & things

Appender

Section.fillin() accepts any object as its target, but it's often helpful for such an object to implement the Appender interface. This allows one to avoid the excessive String concatenation that can occur when implementing Object.toString().

Note that the Section class itself implements Appender, so it implements appendTo() as noted in Printing the template.

TemplateInterceptor

The TemplateInterceptor interface allows one to intercept all templates processed by a TemplateManager and perform actions on them.

SiteGenerator

The SiteGenerator generates a "static" web site from a series of templates. It is designed for easy use from the command line.

TemplateLister

The TemplateLister class can generate a hierarchical listing of a template, as well as code skeleton for pasting into Java code. It is designed for easy use from the command line or within a web application.

Logging

Tmplz generates logs via the java.util.logging package. Most log data is generated during the template loading process, since it's kind of tricky. All information is written to a Logger instance obtained via Logger.getLogger("org.tmotte.tmplz"). Some folks don't like java.util.logging, but we use it because it's supported by all certified Java Enterprise Edition servers.