Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 522EB2009D9 for ; Thu, 19 May 2016 21:02:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 50D36160A37; Thu, 19 May 2016 19:02:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A1D28160A2A for ; Thu, 19 May 2016 21:02:17 +0200 (CEST) Received: (qmail 24202 invoked by uid 500); 19 May 2016 19:02:16 -0000 Mailing-List: contact commits-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list commits@curator.apache.org Received: (qmail 24004 invoked by uid 99); 19 May 2016 19:02:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2016 19:02:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 565AAE7E34; Thu, 19 May 2016 19:02:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: randgalt@apache.org To: commits@curator.apache.org Date: Thu, 19 May 2016 19:02:23 -0000 Message-Id: <1ad205038b0a4c9e91857966cca01a3d@git.apache.org> In-Reply-To: <5d8cb1cc156f48329bb3e7a68da3f048@git.apache.org> References: <5d8cb1cc156f48329bb3e7a68da3f048@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/35] curator git commit: Make regex optional and add a key to each schema archived-at: Thu, 19 May 2016 19:02:18 -0000 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 Authored: Mon May 2 17:03:54 2016 -0500 Committer: randgalt 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; + } +}