[Minor] Added hashcode() and equals() to Locator
This commit is contained in:
parent
bca42e35c8
commit
bbd862de72
|
@ -220,6 +220,31 @@ public class Locator {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((this.pathElements == null) ? 0 : this.pathElements.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
Locator other = (Locator) obj;
|
||||||
|
if (this.pathElements == null) {
|
||||||
|
if (other.pathElements != null)
|
||||||
|
return false;
|
||||||
|
} else if (!this.pathElements.equals(other.pathElements))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link LocatorBuilder} is used to build {@link Locator}s where a deep hierarchy is to be created. The
|
* {@link LocatorBuilder} is used to build {@link Locator}s where a deep hierarchy is to be created. The
|
||||||
* {@link #append(String)} method returns itself for chain building
|
* {@link #append(String)} method returns itself for chain building
|
||||||
|
|
Loading…
Reference in New Issue