You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2019/03/22 11:07:37 UTC

[curator] branch master updated: CURATOR-511: Add toString to ZKPaths PathAndNode

This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a7618f  CURATOR-511: Add toString to ZKPaths PathAndNode
     new 5ff7952  Merge pull request #305 from BELUGABEHR/CURATOR-511
8a7618f is described below

commit 8a7618ff20876197827489f852f9c2160ee1f063
Author: Beluga Behr <da...@gmail.com>
AuthorDate: Thu Mar 21 18:04:13 2019 -0400

    CURATOR-511: Add toString to ZKPaths PathAndNode
---
 .../java/org/apache/curator/utils/ZKPaths.java     | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
index 378e25d..a7a9bd2 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
@@ -154,6 +154,49 @@ public class ZKPaths
         {
             return node;
         }
+
+        @Override
+        public int hashCode()
+        {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + node.hashCode();
+            result = prime * result + path.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;
+            }
+            PathAndNode other = (PathAndNode) obj;
+            if (!node.equals(other.node))
+            {
+              return false;
+            }
+            if (!path.equals(other.path))
+            {
+              return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String toString()
+        {
+            return "PathAndNode [path=" + path + ", node=" + node + "]";
+        }
     }
 
     /**