]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffMissingXml.java
Introduce org.argeo.slc.support.simple
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / diff / DiffMissingXml.java
1 package org.argeo.slc.diff;
2
3 /**
4 * <code>DiffMissing</code> using the XPath of the position as
5 * <code>DiffKey</code>
6 */
7 public class DiffMissingXml extends DiffMissing {
8
9 public DiffMissingXml(XPathDiffPosition position) {
10 super(position, new DiffKeyXml(position.getXPath()));
11 }
12
13 /** Implementation of <code>DiffKey</code> based on an XPath string. */
14 protected static class DiffKeyXml implements DiffKey {
15 private final String xPath;
16
17 public DiffKeyXml(String xPath) {
18 this.xPath = xPath;
19 }
20
21 public String getXPath() {
22 return xPath;
23 }
24
25 @Override
26 public String toString() {
27 return xPath;
28 }
29
30 @Override
31 public boolean equals(Object obj) {
32 if (!(obj instanceof DiffKeyXml))
33 return false;
34 return xPath.equals(((DiffKeyXml) obj).xPath);
35 }
36
37 @Override
38 public int hashCode() {
39 return xPath.hashCode();
40 }
41
42 }
43 }