|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface TemplateEngine
A TemplateEngine typically evaluates a template containing variables against a context containing values for those variables. The canonical java Template Engines are WebMacro and Velocity.
| Method Summary | |
|---|---|
void |
addRoot(java.lang.String root)
Add a template root directory. |
java.lang.String |
expandedTemplate(Template template,
TemplateContext templateContext)
Expand the Template against the context and return the expansion as a string. |
void |
expandTemplate(MelatiWriter out,
java.lang.String templateName,
TemplateContext templateContext)
Expand the Template against the context. |
void |
expandTemplate(MelatiWriter out,
Template template,
TemplateContext templateContext)
Expand the Template against the context. |
java.lang.Object |
getEngine()
Get the underlying engine. |
java.lang.String |
getName()
The name of the template engine (used to find the templets). |
java.util.Enumeration |
getRoots()
A root should not end in a slash. |
MelatiStringWriter |
getStringWriter()
|
TemplateContext |
getTemplateContext(Melati melati)
Create a new Context for this engine. |
java.lang.String |
getTemplateName(java.lang.String key,
java.lang.String classifier)
The name of a template which exists. |
void |
init(MelatiConfig melatiConfig)
Initialise the Engine. |
Template |
template(java.lang.String templateName)
Get a template given it's full name. |
java.lang.String |
templateExtension()
|
| Method Detail |
|---|
void init(MelatiConfig melatiConfig)
throws TemplateEngineException
melatiConfig - a MelatiConfig
TemplateEngineException - if any problem occurs with the engine
TemplateContext getTemplateContext(Melati melati)
throws TemplateEngineException
melati - the Melati
TemplateContext
TemplateEngineException - if any problem occurs with the enginejava.lang.String getName()
java.lang.String templateExtension()
java.util.Enumeration getRoots()
void addRoot(java.lang.String root)
root - the root to add
Template template(java.lang.String templateName)
throws java.io.IOException,
NotFoundException
templateName - the name of the template to find
java.io.IOException - if TemplateEngine does
NotFoundException - if template not found
java.lang.String getTemplateName(java.lang.String key,
java.lang.String classifier)
key - short name, without path or extensionclassifier - a purpose or database name or similar qualifier
void expandTemplate(MelatiWriter out,
java.lang.String templateName,
TemplateContext templateContext)
throws java.io.IOException,
NotFoundException
out - a MelatiWriter to output ontemplateName - the name of the template to expandtemplateContext - the ServletTemplateContext to expand
the template against
java.io.IOException - if TemplateEngine does
NotFoundException - if template not found
void expandTemplate(MelatiWriter out,
Template template,
TemplateContext templateContext)
throws java.io.IOException
out - a MelatiWriter to output ontemplate - the Template to expandtemplateContext - the ServletTemplateContext to expand
the template against
java.io.IOException - if TemplateEngine does
java.lang.String expandedTemplate(Template template,
TemplateContext templateContext)
throws java.io.IOException
template - the Template to expandtemplateContext - the ServletTemplateContext to expand
the template against
java.io.IOException - if TemplateEngine doesMelatiStringWriter getStringWriter()
MelatiStringWriter.Melati.getStringWriter()java.lang.Object getEngine()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||