Package eu.maveniverse.domtrip
Class XmlChange
- java.lang.Object
-
- eu.maveniverse.domtrip.XmlChange
-
public class XmlChange extends java.lang.ObjectRepresents a single change detected between two XML documents.Each change has a
type, an XPath-likepathidentifying the location, and optional before/after values and node references.Example output:
ELEMENT_ADDED: /project/dependencies/dependency[3] TEXT_CHANGED: /project/version: "1.0" → "1.1" ATTRIBUTE_CHANGED: /project/dependencies/dependency[2]/@scope: "compile" → "test"
- Since:
- 1.3.0
- See Also:
ChangeType,DiffResult,XmlDiff
-
-
Constructor Summary
Constructors Constructor Description XmlChange(ChangeType type, java.lang.String path, java.lang.String beforeValue, java.lang.String afterValue, Node beforeNode, Node afterNode)Creates a new XmlChange.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeafterNode()Returns the node after the change, ornullfor removals.java.lang.StringafterValue()Returns the value after the change, ornullfor removals.NodebeforeNode()Returns the node before the change, ornullfor additions.java.lang.StringbeforeValue()Returns the value before the change, ornullfor additions.booleanequals(java.lang.Object o)inthashCode()booleanisFormattingOnly()Returnstrueif the change is formatting-only (no semantic effect).booleanisSemantic()Returnstrueif the change affects the semantic meaning of the XML.java.lang.Stringpath()Returns the XPath-like path to the changed node.java.lang.StringtoString()ChangeTypetype()Returns the type of change.
-
-
-
Constructor Detail
-
XmlChange
public XmlChange(ChangeType type, java.lang.String path, java.lang.String beforeValue, java.lang.String afterValue, Node beforeNode, Node afterNode)
Creates a new XmlChange.- Parameters:
type- the type of changepath- the XPath-like path to the changed nodebeforeValue- the value before the change, ornullfor additionsafterValue- the value after the change, ornullfor removalsbeforeNode- the node before the change, ornullfor additionsafterNode- the node after the change, ornullfor removals
-
-
Method Detail
-
type
public ChangeType type()
Returns the type of change.- Returns:
- the change type
-
path
public java.lang.String path()
Returns the XPath-like path to the changed node.- Returns:
- the path
-
isSemantic
public boolean isSemantic()
Returnstrueif the change affects the semantic meaning of the XML.- Returns:
trueif semantic
-
isFormattingOnly
public boolean isFormattingOnly()
Returnstrueif the change is formatting-only (no semantic effect).- Returns:
trueif formatting-only
-
beforeValue
public java.lang.String beforeValue()
Returns the value before the change, ornullfor additions.- Returns:
- the before value
-
afterValue
public java.lang.String afterValue()
Returns the value after the change, ornullfor removals.- Returns:
- the after value
-
beforeNode
public Node beforeNode()
Returns the node before the change, ornullfor additions.- Returns:
- the before node
-
afterNode
public Node afterNode()
Returns the node after the change, ornullfor removals.- Returns:
- the after node
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-