* Represents unique path to the every node inside the module.
*/
public abstract class SchemaPath implements Immutable {
+
/**
* An absolute SchemaPath.
*/
*/
private volatile ImmutableList<QName> legacyPath;
+ protected SchemaPath(final SchemaPath parent, final QName qname) {
+ this.parent = parent;
+ this.qname = qname;
+
+ int h = parent == null ? 0 : parent.hashCode();
+ if (qname != null) {
+ h = h * 31 + qname.hashCode();
+ }
+
+ hash = h;
+ }
+
private ImmutableList<QName> getLegacyPath() {
ImmutableList<QName> ret = legacyPath;
if (ret == null) {
return getLegacyPath();
}
- protected SchemaPath(final SchemaPath parent, final QName qname) {
- this.parent = parent;
- this.qname = qname;
-
- int h = parent == null ? 0 : parent.hashCode();
- if (qname != null) {
- h = h * 31 + qname.hashCode();
- }
-
- hash = h;
- }
-
/**
* Constructs new instance of this class with the concrete path.
*
return this;
}
- SchemaPath parent = this;
+ SchemaPath parentPath = this;
for (QName qname : relative) {
- parent = parent.createInstance(parent, qname);
+ parentPath = parentPath.createInstance(parentPath, qname);
}
- return parent;
+ return parentPath;
}
/**
public SchemaPath createChild(final SchemaPath relative) {
Preconditions.checkArgument(!relative.isAbsolute(), "Child creation requires relative path");
- SchemaPath parent = this;
+ SchemaPath parentPath = this;
for (QName qname : relative.getPathFromRoot()) {
- parent = parent.createInstance(parent, qname);
+ parentPath = parentPath.createInstance(parentPath, qname);
}
- return parent;
+ return parentPath;
}
/**