Class XmlInterface
- java.lang.Object
-
- net.sourceforge.pmd.util.fxdesigner.util.beans.XmlInterface
-
- Direct Known Subclasses:
XmlInterfaceVersion1
public abstract class XmlInterface extends java.lang.Object
Represents a version of the Xml format used to store settings. The parser and serializer must understand each other, so they're kept together.- Since:
- 6.1.0
- Author:
- Clément Fournier
-
-
Constructor Summary
Constructors Constructor Description XmlInterface(int rev)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canParse(org.w3c.dom.Document document)
Returns true if the document can be read by this object.protected abstract BeanNodeVisitor<org.w3c.dom.Element>
getDocumentMakerVisitor()
Gets a visitor which populates xml elements with corresponding nodes.int
getRevisionNumber()
protected abstract SimpleBeanModelNode
parseSettingsOwnerNode(org.w3c.dom.Element nodeElement)
Parses a settings node and its descendants recursively.java.util.Optional<SimpleBeanModelNode>
parseXml(org.w3c.dom.Document document)
Parses a XML document produced bywriteModelToXml(File, SimpleBeanModelNode)
into a settings node.void
writeModelToXml(java.io.File output, SimpleBeanModelNode model)
Writes the model to a file.
-
-
-
Method Detail
-
getRevisionNumber
public int getRevisionNumber()
-
parseXml
public final java.util.Optional<SimpleBeanModelNode> parseXml(org.w3c.dom.Document document)
Parses a XML document produced bywriteModelToXml(File, SimpleBeanModelNode)
into a settings node.- Parameters:
document
- The document to parse- Returns:
- The root of the model hierarchy, or empty if the revision is not supported
-
canParse
public boolean canParse(org.w3c.dom.Document document)
Returns true if the document can be read by this object.- Parameters:
document
- Document to test
-
writeModelToXml
public final void writeModelToXml(java.io.File output, SimpleBeanModelNode model) throws java.io.IOException
Writes the model to a file.- Parameters:
output
- The output filemodel
- The model to serialize- Throws:
java.io.IOException
- If saving the settings failed
-
parseSettingsOwnerNode
protected abstract SimpleBeanModelNode parseSettingsOwnerNode(org.w3c.dom.Element nodeElement)
Parses a settings node and its descendants recursively.- Parameters:
nodeElement
- Element to parse- Returns:
- The model described by the element
-
getDocumentMakerVisitor
protected abstract BeanNodeVisitor<org.w3c.dom.Element> getDocumentMakerVisitor()
Gets a visitor which populates xml elements with corresponding nodes.- Returns:
- A visitor
-
-