|
||||||||||
| 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(String root)
Add a template root directory. |
String |
expandedTemplate(Template template,
TemplateContext templateContext)
Expand the Template against the context and return the expansion as a string. |
void |
expandTemplate(MelatiWriter out,
String templateName,
TemplateContext templateContext)
Expand the Template against the context. |
void |
expandTemplate(MelatiWriter out,
Template template,
TemplateContext templateContext)
Expand the Template against the context, unwrapping any Access Exceptions. |
Object |
getEngine()
Get the underlying engine. |
String |
getName()
The name of the template engine (used to find the templets). |
Enumeration<String> |
getRoots()
A root should not end in a slash. |
MelatiStringWriter |
getStringWriter()
|
TemplateContext |
getTemplateContext(Melati melati)
Create a new Context for this engine. |
String |
getTemplateName(String key,
String classifier)
The name of a template which exists. |
void |
init(MelatiConfig melatiConfig)
Initialise the Engine. |
Template |
template(String templateName)
Get a template given it's full name. |
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 engineString getName()
String templateExtension()
Enumeration<String> getRoots()
void addRoot(String root)
root - the root to add
Template template(String templateName)
throws NotFoundException
templateName - the name of the template to find
NotFoundException - if template not found
String getTemplateName(String key,
String classifier)
key - short name, without path or extensionclassifier - a purpose or database name or similar qualifier
void expandTemplate(MelatiWriter out,
String templateName,
TemplateContext templateContext)
throws NotFoundException
out - a MelatiWriter to output ontemplateName - the name of the template to expandtemplateContext - the ServletTemplateContext to expand
the template against
NotFoundException - if template not found
void expandTemplate(MelatiWriter out,
Template template,
TemplateContext templateContext)
out - a MelatiWriter to output ontemplate - the Template to expandtemplateContext - the ServletTemplateContext to expand
the template against
String expandedTemplate(Template template,
TemplateContext templateContext)
template - the Template to expandtemplateContext - the ServletTemplateContext to expand
the template against
MelatiStringWriter getStringWriter()
MelatiStringWriter.Melati.getStringWriter()Object getEngine()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||