Add DataTreeIdentifier.toString()
[mdsal.git] / binding / mdsal-binding-api / src / main / java / org / opendaylight / mdsal / binding / api / DataTreeIdentifier.java
index 0ae385641f55d5b9e93cc0296645452b9c56dab6..5193465864f699d719cdfde872d5cd261df89b68 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.mdsal.binding.api;
 
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import java.io.Serializable;
 import javax.annotation.Nonnull;
@@ -20,7 +21,8 @@ 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<T extends DataObject> 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<T> rootIdentifier;
     private final LogicalDatastoreType datastoreType;
@@ -40,7 +42,8 @@ public final class DataTreeIdentifier<T extends DataObject> implements Immutable
      *
      * @return Logical data store type. Guaranteed to be non-null.
      */
-    public @Nonnull LogicalDatastoreType getDatastoreType() {
+    @Nonnull
+    public LogicalDatastoreType getDatastoreType() {
         return datastoreType;
     }
 
@@ -49,7 +52,8 @@ public final class DataTreeIdentifier<T extends DataObject> implements Immutable
      *
      * @return Instance identifier corresponding to the root node.
      */
-    public @Nonnull InstanceIdentifier<T> getRootIdentifier() {
+    @Nonnull
+    public InstanceIdentifier<T> getRootIdentifier() {
         return rootIdentifier;
     }
 
@@ -81,4 +85,9 @@ public final class DataTreeIdentifier<T extends DataObject> implements Immutable
         }
         return rootIdentifier.equals(other.rootIdentifier);
     }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this).add("datastore", datastoreType).add("root", rootIdentifier).toString();
+    }
 }
\ No newline at end of file