curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [08/35] curator git commit: Make regex optional and add a key to each schema
Date Thu, 19 May 2016 19:02:23 GMT
Make regex optional and add a key to each schema


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f83c8efc
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f83c8efc
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f83c8efc

Branch: refs/heads/CURATOR-3.0
Commit: f83c8efcfbd4781d64ef4e7ef37c12ff68de12a1
Parents: 3f47f6a
Author: randgalt <randgalt@apache.org>
Authored: Mon May 2 17:03:54 2016 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Mon May 2 17:03:54 2016 -0500

----------------------------------------------------------------------
 .../curator/framework/schema/SchemaKey.java     | 59 ++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/f83c8efc/curator-framework/src/main/java/org/apache/curator/framework/schema/SchemaKey.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/schema/SchemaKey.java
b/curator-framework/src/main/java/org/apache/curator/framework/schema/SchemaKey.java
new file mode 100644
index 0000000..0faabb1
--- /dev/null
+++ b/curator-framework/src/main/java/org/apache/curator/framework/schema/SchemaKey.java
@@ -0,0 +1,59 @@
+package org.apache.curator.framework.schema;
+
+import com.google.common.base.Preconditions;
+import java.util.UUID;
+
+public class SchemaKey
+{
+    private final String key;
+
+    public static SchemaKey named(String name)
+    {
+        return new SchemaKey(name);
+    }
+
+    public SchemaKey()
+    {
+        this(UUID.randomUUID().toString());
+    }
+
+    public SchemaKey(String key)
+    {
+        this.key = Preconditions.checkNotNull(key, "key cannot be null");
+    }
+
+    public String getKey()
+    {
+        return key;
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        SchemaKey schemaKey = (SchemaKey)o;
+
+        return key.equals(schemaKey.key);
+
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return key.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        return key;
+    }
+}


Mime
View raw message