import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.concepts.Path;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
* A unique identifier for a particular subtree. It is composed of the logical
* data store type and the instance identifier of the root node.
*/
-public final class DataTreeIdentifier implements Immutable, Path<DataTreeIdentifier>, Serializable {
+public final class DataTreeIdentifier<T extends DataObject> implements Immutable, Path<DataTreeIdentifier<?>>, Serializable {
private static final long serialVersionUID = 1L;
- private final InstanceIdentifier<?> rootIdentifier;
+ private final InstanceIdentifier<T> rootIdentifier;
private final LogicalDatastoreType datastoreType;
- public DataTreeIdentifier(final LogicalDatastoreType datastoreType, final InstanceIdentifier<?> rootIdentifier) {
+ public DataTreeIdentifier(final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> rootIdentifier) {
this.datastoreType = Preconditions.checkNotNull(datastoreType);
this.rootIdentifier = Preconditions.checkNotNull(rootIdentifier);
}
}
/**
- * Return the {@link YangInstanceIdentifier} of the root node.
+ * Return the {@link InstanceIdentifier} of the root node.
*
* @return Instance identifier corresponding to the root node.
*/
- public @Nonnull InstanceIdentifier<?> getRootIdentifier() {
+ public @Nonnull InstanceIdentifier<T> getRootIdentifier() {
return rootIdentifier;
}
@Override
- public boolean contains(final DataTreeIdentifier other) {
+ public boolean contains(final DataTreeIdentifier<?> other) {
return datastoreType == other.datastoreType && rootIdentifier.contains(other.rootIdentifier);
}
if (!(obj instanceof DataTreeIdentifier)) {
return false;
}
- DataTreeIdentifier other = (DataTreeIdentifier) obj;
+ final DataTreeIdentifier<?> other = (DataTreeIdentifier<?>) obj;
if (datastoreType != other.datastoreType) {
return false;
}
return rootIdentifier.equals(other.rootIdentifier);
}
-}
\ No newline at end of file
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "{datastoreType = " + datastoreType + ", rootIdentifier = " +
+ rootIdentifier + "}";
+ }
+}