You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ka...@apache.org on 2018/02/08 09:05:13 UTC

[12/14] storm git commit: STORM-2937: Overwrite storm-kafka-client 1.x-branch into 1.0.x-branch: backport changes to Fields

STORM-2937: Overwrite storm-kafka-client 1.x-branch into 1.0.x-branch: backport changes to Fields

Cherry-picked from a3e6f60f.

This allows Fields to be checked for equality in storm-kafka-client unit tests.


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

Branch: refs/heads/1.0.x-branch
Commit: 6d92df30d9d47ac5996009146683afa9ee83122e
Parents: 4492b3e
Author: Erik Weathers <er...@gmail.com>
Authored: Tue Feb 6 19:47:22 2018 -0800
Committer: Erik Weathers <er...@gmail.com>
Committed: Wed Feb 7 18:53:24 2018 -0800

----------------------------------------------------------------------
 .../src/jvm/org/apache/storm/tuple/Fields.java      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/6d92df30/storm-core/src/jvm/org/apache/storm/tuple/Fields.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/tuple/Fields.java b/storm-core/src/jvm/org/apache/storm/tuple/Fields.java
index 8945a73..6919b09 100644
--- a/storm-core/src/jvm/org/apache/storm/tuple/Fields.java
+++ b/storm-core/src/jvm/org/apache/storm/tuple/Fields.java
@@ -29,6 +29,7 @@ import java.io.Serializable;
  * Collection of unique named fields using in an ITuple
  */
 public class Fields implements Iterable<String>, Serializable {
+    private static final long serialVersionUID = -3377931843059975424L;
     private List<String> _fields;
     private Map<String, Integer> _index = new HashMap<>();
     
@@ -114,4 +115,19 @@ public class Fields implements Iterable<String>, Serializable {
     public String toString() {
         return _fields.toString();
     }    
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) return true;
+        if (other instanceof Fields) {
+            Fields of = (Fields)other;
+            return _fields.equals(of._fields);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return _fields.hashCode();
+    }
 }