import static java.util.Objects.requireNonNull;
import com.google.common.base.MoreObjects;
-import java.io.Serializable;
-import java.util.Iterator;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.yangtools.concepts.Immutable;
-import org.opendaylight.yangtools.concepts.Path;
+import org.opendaylight.yangtools.concepts.HierarchicalIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
/**
* A unique identifier for a particular subtree. It is composed of the logical data store type and the instance
* identifier of the root node.
*/
@NonNullByDefault
-public final class DOMDataTreeIdentifier implements Immutable, Path<DOMDataTreeIdentifier>, Serializable,
+public final class DOMDataTreeIdentifier implements HierarchicalIdentifier<DOMDataTreeIdentifier>,
Comparable<DOMDataTreeIdentifier> {
+ @java.io.Serial
private static final long serialVersionUID = 1L;
private final YangInstanceIdentifier rootIdentifier;
}
public DOMDataTreeIdentifier toOptimized() {
- final YangInstanceIdentifier opt = rootIdentifier.toOptimized();
+ final var opt = rootIdentifier.toOptimized();
return opt == rootIdentifier ? this : new DOMDataTreeIdentifier(datastoreType, opt);
}
@Override
public boolean equals(final @Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof DOMDataTreeIdentifier)) {
- return false;
- }
- DOMDataTreeIdentifier other = (DOMDataTreeIdentifier) obj;
- return datastoreType == other.datastoreType && rootIdentifier.equals(other.rootIdentifier);
+ return this == obj || obj instanceof DOMDataTreeIdentifier other && datastoreType == other.datastoreType
+ && rootIdentifier.equals(other.rootIdentifier);
}
@Override
return cmp;
}
- final Iterator<PathArgument> myIter = rootIdentifier.getPathArguments().iterator();
- final Iterator<PathArgument> otherIter = domDataTreeIdentifier.rootIdentifier.getPathArguments().iterator();
+ final var myIter = rootIdentifier.getPathArguments().iterator();
+ final var otherIter = domDataTreeIdentifier.rootIdentifier.getPathArguments().iterator();
while (myIter.hasNext()) {
if (!otherIter.hasNext()) {
return 1;
}
- final PathArgument myPathArg = myIter.next();
- final PathArgument otherPathArg = otherIter.next();
+ final var myPathArg = myIter.next();
+ final var otherPathArg = otherIter.next();
cmp = myPathArg.compareTo(otherPathArg);
if (cmp != 0) {
return cmp;
public String toString() {
return MoreObjects.toStringHelper(this).add("datastore", datastoreType).add("root", rootIdentifier).toString();
}
+
+ @java.io.Serial
+ Object writeReplace() {
+ return new DTIv1(this);
+ }
}