Class XMLGeneratorVisitor
- java.lang.Object
-
- net.sf.ehcache.config.generator.model.AbstractDepthFirstVisitor
-
- net.sf.ehcache.config.generator.model.XMLGeneratorVisitor
-
- All Implemented Interfaces:
NodeElementVisitor
public class XMLGeneratorVisitor extends AbstractDepthFirstVisitor
Implementation of an ElementVisitor extending fromAbstractDepthFirstVisitorwhich can generate XML out of aNodeElement. Accepts aPrintWriterin the constructor and uses it to output the generated XML. Output can be controlled by enabling/disabling the various options present inXMLGeneratorVisitor.OutputBehaviorby callingenableOutputBehavior(OutputBehavior)ordisableOutputBehavior(OutputBehavior)- Author:
- Abhishek Sanoujam
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMLGeneratorVisitor.OutputBehaviorEnum controlling the generated XML output
-
Constructor Summary
Constructors Constructor Description XMLGeneratorVisitor(java.io.PrintWriter out)Constructor accepting thePrintWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableAllOutputBehaviors()Disables all output behaviorsvoiddisableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)Disables one particularXMLGeneratorVisitor.OutputBehaviorvoidenableAllOutputBehaviors()Enables all output behaviorsvoidenableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)Enables one particularXMLGeneratorVisitor.OutputBehaviorprotected voidendAttributes(NodeElement element)Finish visiting attributes of the element.protected voidendChildren(NodeElement element)Finish visiting children of the element.protected voidendElement(NodeElement element)Finish visiting the element.booleanisOutputBehaviorEnabled(XMLGeneratorVisitor.OutputBehavior behavior)Returns true if the output behavior is enabledprotected voidstartAttributes(NodeElement element)Starts visiting the attributes of the element.protected voidstartChildren(NodeElement element)Starts visiting children of the element.protected voidstartElement(NodeElement element)Starts visiting an element.protected voidvisitAttribute(NodeElement element, NodeAttribute attribute)Visits an attribute.protected voidvisitAttributes(NodeElement element, java.util.List<NodeAttribute> attributes)Visits the attributes of the element.protected voidvisitElement(NodeElement element)Visits the element.-
Methods inherited from class net.sf.ehcache.config.generator.model.AbstractDepthFirstVisitor
visit
-
-
-
-
Method Detail
-
enableAllOutputBehaviors
public void enableAllOutputBehaviors()
Enables all output behaviors
-
disableAllOutputBehaviors
public void disableAllOutputBehaviors()
Disables all output behaviors
-
enableOutputBehavior
public void enableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)
Enables one particularXMLGeneratorVisitor.OutputBehavior- Parameters:
behavior-
-
disableOutputBehavior
public void disableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)
Disables one particularXMLGeneratorVisitor.OutputBehavior- Parameters:
behavior-
-
isOutputBehaviorEnabled
public boolean isOutputBehaviorEnabled(XMLGeneratorVisitor.OutputBehavior behavior)
Returns true if the output behavior is enabled- Parameters:
behavior- the output behavior to inspect- Returns:
- true if enabled, otherwise false
-
startElement
protected void startElement(NodeElement element)
Starts visiting an element. Override as needed- Overrides:
startElementin classAbstractDepthFirstVisitor- Parameters:
element- the element
-
startAttributes
protected void startAttributes(NodeElement element)
Starts visiting the attributes of the element. Override as needed- Overrides:
startAttributesin classAbstractDepthFirstVisitor- Parameters:
element- the element
-
visitAttributes
protected void visitAttributes(NodeElement element, java.util.List<NodeAttribute> attributes)
Visits the attributes of the element. Override as needed- Overrides:
visitAttributesin classAbstractDepthFirstVisitor- Parameters:
element- the elementattributes- the attributes
-
visitAttribute
protected void visitAttribute(NodeElement element, NodeAttribute attribute)
Visits an attribute.- Parameters:
element-attribute-
-
endAttributes
protected void endAttributes(NodeElement element)
Finish visiting attributes of the element. Override as needed- Overrides:
endAttributesin classAbstractDepthFirstVisitor- Parameters:
element- the element
-
visitElement
protected void visitElement(NodeElement element)
Visits the element. Override as needed- Overrides:
visitElementin classAbstractDepthFirstVisitor- Parameters:
element- the element
-
startChildren
protected void startChildren(NodeElement element)
Starts visiting children of the element. Override as needed- Overrides:
startChildrenin classAbstractDepthFirstVisitor- Parameters:
element- the element
-
endChildren
protected void endChildren(NodeElement element)
Finish visiting children of the element. Override as needed- Overrides:
endChildrenin classAbstractDepthFirstVisitor- Parameters:
element- the element
-
endElement
protected void endElement(NodeElement element)
Finish visiting the element. Override as needed- Overrides:
endElementin classAbstractDepthFirstVisitor- Parameters:
element- the element
-
-