Class AbstractTemplateHandler
- Object
-
- org.thymeleaf.engine.AbstractTemplateHandler
-
- All Implemented Interfaces:
ITemplateHandler
- Direct Known Subclasses:
ModelBuilderTemplateHandler,OutputTemplateHandler
public abstract class AbstractTemplateHandler extends Object implements ITemplateHandler
Basic abstract implementation of
ITemplateHandlerthat 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.- Since:
- 3.0.0
- Author:
- Daniel Fernández
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTemplateHandler()Create a new instance of this handler, not specifying the 'next' handler.protectedAbstractTemplateHandler(ITemplateHandler next)Create a new instance of this handler, specifying the handler that will be used as next step in the chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ITemplateContextgetContext()Return the processing context corresponding to the template execution for which the template handler instance has been created.protected ITemplateHandlergetNext()Return the next handler in the chain, so that events can be delegated to it.voidhandleCDATASection(ICDATASection cdataSection)voidhandleCloseElement(ICloseElementTag closeElementTag)voidhandleComment(IComment comment)voidhandleDocType(IDocType docType)voidhandleOpenElement(IOpenElementTag openElementTag)voidhandleProcessingInstruction(IProcessingInstruction processingInstruction)voidhandleStandaloneElement(IStandaloneElementTag standaloneElementTag)voidhandleTemplateEnd(ITemplateEnd templateEnd)voidhandleTemplateStart(ITemplateStart templateStart)voidhandleText(IText text)voidhandleXMLDeclaration(IXMLDeclaration xmlDeclaration)voidsetContext(ITemplateContext context)Set the processing context to be used, including template name, context, and also the engine configuration.voidsetNext(ITemplateHandler next)Set the next handler in the chain, so that events can be (optionally) delegated to it.
-
-
-
Constructor Detail
-
AbstractTemplateHandler
protected AbstractTemplateHandler(ITemplateHandler next)
Create a new instance of this handler, specifying the handler that will be used as next step in the chain.
- Parameters:
next- the next step in the chain.
-
AbstractTemplateHandler
protected AbstractTemplateHandler()
Create a new instance of this handler, not specifying the 'next' handler.
-
-
Method Detail
-
setNext
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.
- Specified by:
setNextin interfaceITemplateHandler- Parameters:
next- the next handler in the chain.
-
setContext
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.
- Specified by:
setContextin interfaceITemplateHandler- Parameters:
context- the processing context.
-
getNext
protected final ITemplateHandler getNext()
Return the next handler in the chain, so that events can be delegated to it.
- Returns:
- the next handler in the chain.
-
getContext
protected final ITemplateContext getContext()
Return the processing context corresponding to the template execution for which the template handler instance has been created.
- Returns:
- the processing context
-
handleTemplateStart
public void handleTemplateStart(ITemplateStart templateStart)
- Specified by:
handleTemplateStartin interfaceITemplateHandler
-
handleTemplateEnd
public void handleTemplateEnd(ITemplateEnd templateEnd)
- Specified by:
handleTemplateEndin interfaceITemplateHandler
-
handleXMLDeclaration
public void handleXMLDeclaration(IXMLDeclaration xmlDeclaration)
- Specified by:
handleXMLDeclarationin interfaceITemplateHandler
-
handleDocType
public void handleDocType(IDocType docType)
- Specified by:
handleDocTypein interfaceITemplateHandler
-
handleCDATASection
public void handleCDATASection(ICDATASection cdataSection)
- Specified by:
handleCDATASectionin interfaceITemplateHandler
-
handleComment
public void handleComment(IComment comment)
- Specified by:
handleCommentin interfaceITemplateHandler
-
handleText
public void handleText(IText text)
- Specified by:
handleTextin interfaceITemplateHandler
-
handleStandaloneElement
public void handleStandaloneElement(IStandaloneElementTag standaloneElementTag)
- Specified by:
handleStandaloneElementin interfaceITemplateHandler
-
handleOpenElement
public void handleOpenElement(IOpenElementTag openElementTag)
- Specified by:
handleOpenElementin interfaceITemplateHandler
-
handleCloseElement
public void handleCloseElement(ICloseElementTag closeElementTag)
- Specified by:
handleCloseElementin interfaceITemplateHandler
-
handleProcessingInstruction
public void handleProcessingInstruction(IProcessingInstruction processingInstruction)
- Specified by:
handleProcessingInstructionin interfaceITemplateHandler
-
-