|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.TemplateProcessorParameters
public final class TemplateProcessorParameters
Parameter class for a Template processor. This is a convenience class for passing parameters to a template processor to apply the template to a model. Any additional parameters can be added to this parameter class without having to alter the method signature of the processor itself.
This is an immutable class. Calls to any of the withXXX()
methods return a new object.
Typical usage:
Reader reader = ...; Template template = new Template(reader); TemplateProcessorParameters tpp = TemplateProcessorParameters .newInstance(writer) .withEventHandler(TemplateEventAdapter.DefaultEventAdapter) .withEscape(HtmlEscape.getInstance()); template.process(tpp);
Method Summary | |
---|---|
TemplateModel |
getEscape()
Get the Template escape model for this parameter object. |
TemplateRuntimeHandler |
getEventHandler()
Get the Template runtime handler for this parameter object. |
TemplateWriteableHashModel |
getModelRoot()
Get the Template model root for this parameter object. |
java.io.Writer |
getWriter()
Get the writer for this parameter object. |
static TemplateProcessorParameters |
newInstance()
Create a new instance of this template processor parameter class. |
static TemplateProcessorParameters |
newInstance(java.io.Writer writer)
Create a new instance of this template processor parameter class with the given writer. |
TemplateProcessorParameters |
withEscape(TemplateModel escape)
Return a new TemplateProcessorParameters object with the given escape TemplateModel in place of the existing escape. |
TemplateProcessorParameters |
withEventHandler(TemplateRuntimeHandler eventHandler)
Return a new TemplateProcessorParameters object with the given event handler in place of the existing event handler. |
TemplateProcessorParameters |
withModel(TemplateWriteableHashModel modelRoot)
Return a new TemplateProcessorParameters object with the given template model in place of the existing template model. |
TemplateProcessorParameters |
withWriter(java.io.Writer writer)
Return a new TemplateProcessorParameters object with the given writer in place of the existing writer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static TemplateProcessorParameters newInstance()
public static TemplateProcessorParameters newInstance(java.io.Writer writer)
writer
- the writer to be passed in to the template processor
java.lang.NullPointerException
- the writer is null
public TemplateProcessorParameters withWriter(java.io.Writer writer)
writer
- the writer to use in place of the existing writer
java.lang.NullPointerException
- the writer is null
public TemplateProcessorParameters withModel(TemplateWriteableHashModel modelRoot)
modelRoot
- the template model to use in place of the existing
template model
java.lang.NullPointerException
- the model root is null
public TemplateProcessorParameters withEventHandler(TemplateRuntimeHandler eventHandler)
eventHandler
- the event handler to use in place of the existing
event handler
java.lang.NullPointerException
- the event handler is null
public TemplateProcessorParameters withEscape(TemplateModel escape)
escape
- the escape TemplateModel to use in place of the existing
escape
public TemplateWriteableHashModel getModelRoot()
public java.io.Writer getWriter()
public TemplateRuntimeHandler getEventHandler()
public TemplateModel getEscape()
null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |