public abstract class AbstractTemplateHandler extends Object implements ITemplateHandler
Basic abstract implementation of ITemplateHandler
that takes care of the whole contract of this
interface and offers a good base for the easy implementation of custom template handlers.
All handleX() implementations in this class are set to simply delegate to the next handler in the chain, so that subclasses can override only the handling methods that are really relevant to them.
Modifier | Constructor and Description |
---|---|
protected |
AbstractTemplateHandler()
Create a new instance of this handler, not specifying the 'next' handler.
|
protected |
AbstractTemplateHandler(ITemplateHandler next)
Create a new instance of this handler, specifying the handler that will be used as next step in the
chain.
|
Modifier and Type | Method and Description |
---|---|
protected ITemplateContext |
getContext()
Return the processing context corresponding to the template execution for
which the template handler instance has been created.
|
protected ITemplateHandler |
getNext()
Return the next handler in the chain, so that events can be delegated to it.
|
void |
handleCDATASection(ICDATASection cdataSection) |
void |
handleCloseElement(ICloseElementTag closeElementTag) |
void |
handleComment(IComment comment) |
void |
handleDocType(IDocType docType) |
void |
handleOpenElement(IOpenElementTag openElementTag) |
void |
handleProcessingInstruction(IProcessingInstruction processingInstruction) |
void |
handleStandaloneElement(IStandaloneElementTag standaloneElementTag) |
void |
handleTemplateEnd(ITemplateEnd templateEnd) |
void |
handleTemplateStart(ITemplateStart templateStart) |
void |
handleText(IText text) |
void |
handleXMLDeclaration(IXMLDeclaration xmlDeclaration) |
void |
setContext(ITemplateContext context)
Set the processing context to be used, including template name, context, and also the
engine configuration.
|
void |
setNext(ITemplateHandler next)
Set the next handler in the chain, so that events can be (optionally) delegated to it.
|
protected AbstractTemplateHandler(ITemplateHandler next)
Create a new instance of this handler, specifying the handler that will be used as next step in the chain.
next
- the next step in the chain.protected AbstractTemplateHandler()
Create a new instance of this handler, not specifying the 'next' handler.
public void setNext(ITemplateHandler next)
Set the next handler in the chain, so that events can be (optionally) delegated to it.
This method is called when the chain of template handlers is conformed, always before starting the parsing and processing of a template.
setNext
in interface ITemplateHandler
next
- the next handler in the chain.public void setContext(ITemplateContext context)
Set the processing context to be used, including template name, context, and also the engine configuration.
This method is called always before starting the parsing and processing of a template.
setContext
in interface ITemplateHandler
context
- the processing context.protected final ITemplateHandler getNext()
Return the next handler in the chain, so that events can be delegated to it.
protected final ITemplateContext getContext()
Return the processing context corresponding to the template execution for which the template handler instance has been created.
public void handleTemplateStart(ITemplateStart templateStart)
handleTemplateStart
in interface ITemplateHandler
public void handleTemplateEnd(ITemplateEnd templateEnd)
handleTemplateEnd
in interface ITemplateHandler
public void handleXMLDeclaration(IXMLDeclaration xmlDeclaration)
handleXMLDeclaration
in interface ITemplateHandler
public void handleDocType(IDocType docType)
handleDocType
in interface ITemplateHandler
public void handleCDATASection(ICDATASection cdataSection)
handleCDATASection
in interface ITemplateHandler
public void handleComment(IComment comment)
handleComment
in interface ITemplateHandler
public void handleText(IText text)
handleText
in interface ITemplateHandler
public void handleStandaloneElement(IStandaloneElementTag standaloneElementTag)
handleStandaloneElement
in interface ITemplateHandler
public void handleOpenElement(IOpenElementTag openElementTag)
handleOpenElement
in interface ITemplateHandler
public void handleCloseElement(ICloseElementTag closeElementTag)
handleCloseElement
in interface ITemplateHandler
public void handleProcessingInstruction(IProcessingInstruction processingInstruction)
handleProcessingInstruction
in interface ITemplateHandler
Copyright © 2016 The THYMELEAF team. All rights reserved.