Class AbstractTemplateHandler
- All Implemented Interfaces:
ITemplateHandler
- Direct Known Subclasses:
ModelBuilderTemplateHandler
,OutputTemplateHandler
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.
- Since:
- 3.0.0
- Author:
- Daniel Fernández
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Create a new instance of this handler, not specifying the 'next' handler.protected
Create a new instance of this handler, specifying the handler that will be used as next step in the chain. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ITemplateContext
Return the processing context corresponding to the template execution for which the template handler instance has been created.protected final 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.
-
Constructor Details
-
AbstractTemplateHandler
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 Details
-
setNext
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:
setNext
in interfaceITemplateHandler
- Parameters:
next
- the next handler in the chain.
-
setContext
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:
setContext
in interfaceITemplateHandler
- Parameters:
context
- the processing context.
-
getNext
Return the next handler in the chain, so that events can be delegated to it.
- Returns:
- the next handler in the chain.
-
getContext
Return the processing context corresponding to the template execution for which the template handler instance has been created.
- Returns:
- the processing context
-
handleTemplateStart
- Specified by:
handleTemplateStart
in interfaceITemplateHandler
-
handleTemplateEnd
- Specified by:
handleTemplateEnd
in interfaceITemplateHandler
-
handleXMLDeclaration
- Specified by:
handleXMLDeclaration
in interfaceITemplateHandler
-
handleDocType
- Specified by:
handleDocType
in interfaceITemplateHandler
-
handleCDATASection
- Specified by:
handleCDATASection
in interfaceITemplateHandler
-
handleComment
- Specified by:
handleComment
in interfaceITemplateHandler
-
handleText
- Specified by:
handleText
in interfaceITemplateHandler
-
handleStandaloneElement
- Specified by:
handleStandaloneElement
in interfaceITemplateHandler
-
handleOpenElement
- Specified by:
handleOpenElement
in interfaceITemplateHandler
-
handleCloseElement
- Specified by:
handleCloseElement
in interfaceITemplateHandler
-
handleProcessingInstruction
- Specified by:
handleProcessingInstruction
in interfaceITemplateHandler
-