brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [03/10] git commit: add equals and tostring for PortMapping
Date Fri, 06 Jun 2014 22:05:21 GMT
add equals and tostring for PortMapping


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/18a5d635
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/18a5d635
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/18a5d635

Branch: refs/heads/master
Commit: 18a5d635eea7da2f62cb3448bb520da9d5ba5109
Parents: 5dde3d6
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Jun 2 17:23:02 2014 +0100
Committer: Andrew Kennedy <adk@magnesium.(none)>
Committed: Fri Jun 6 20:50:57 2014 +0100

----------------------------------------------------------------------
 .../java/brooklyn/location/access/PortMapping.java  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/18a5d635/core/src/main/java/brooklyn/location/access/PortMapping.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/location/access/PortMapping.java b/core/src/main/java/brooklyn/location/access/PortMapping.java
index 7dec489..95adaf1 100644
--- a/core/src/main/java/brooklyn/location/access/PortMapping.java
+++ b/core/src/main/java/brooklyn/location/access/PortMapping.java
@@ -39,4 +39,20 @@ public class PortMapping {
         return Objects.toStringHelper(this).add("public", publicIpId+":"+publicPort).
                 add("private", target+":"+privatePort).toString();
     }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof PortMapping)) return false;
+        PortMapping opm = (PortMapping)obj;
+        return Objects.equal(publicIpId, opm.publicIpId) &&
+            Objects.equal(publicPort, opm.publicPort) &&
+            Objects.equal(target, opm.target) &&
+            Objects.equal(privatePort, opm.privatePort);
+    }
+    
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(publicIpId, publicPort, target, privatePort);
+    }
+    
 }
\ No newline at end of file


Mime
View raw message