xv.text.template
Class Template

java.lang.Object
  extended by xv.text.template.Template
All Implemented Interfaces:
Serializable

public class Template
extends Object
implements Serializable

A Template provides a somewhat more robust ability to template strings than NLS.format(String, Object...).

At present, the template implements a simple substitution scheme very similar to the scheme used by JSP EL: anything within "${}" is replaced based on the contents.

The template language also allows C/C++ style comments (exactly like Java does), which will be removed from the final template.

For future expansion, the templating language reserves C preprocessor style "#" commands. Likewise, "$" is a reserved character that should be escaped by using "$$".

Author:
xv
See Also:
Serialized Form

Constructor Summary
Template(TemplateElement rootElement)
           
 
Method Summary
 String execute(TemplateEnvironment environment)
           
 void execute(TemplateEnvironment environment, Appendable out)
           
static Template parse(Reader in)
           
static Template parse(String template)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Template

public Template(TemplateElement rootElement)
Method Detail

execute

public String execute(TemplateEnvironment environment)
               throws TemplateException
Throws:
TemplateException

execute

public void execute(TemplateEnvironment environment,
                    Appendable out)
             throws TemplateException,
                    IOException
Throws:
TemplateException
IOException

parse

public static Template parse(String template)
                      throws TemplateException
Throws:
TemplateException

parse

public static Template parse(Reader in)
                      throws IOException,
                             TemplateException
Throws:
IOException
TemplateException


Copyright © 2008-2011. All Rights Reserved.