struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [2/3] git commit: Implements equal/hashCode
Date Tue, 05 Aug 2014 07:38:44 GMT
Implements equal/hashCode


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

Branch: refs/heads/develop
Commit: 51b16bde8bbd2013427b704659fef6be033fa1e1
Parents: ce49822
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Tue Aug 5 09:38:08 2014 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Tue Aug 5 09:38:08 2014 +0200

----------------------------------------------------------------------
 .../struts2/components/template/Template.java   | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/51b16bde/core/src/main/java/org/apache/struts2/components/template/Template.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/template/Template.java b/core/src/main/java/org/apache/struts2/components/template/Template.java
index b6bbfdb..d4f39e6 100644
--- a/core/src/main/java/org/apache/struts2/components/template/Template.java
+++ b/core/src/main/java/org/apache/struts2/components/template/Template.java
@@ -89,4 +89,27 @@ public class Template implements Cloneable {
     protected Object clone() throws CloneNotSupportedException {
         return super.clone();
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Template template = (Template) o;
+
+        if (dir != null ? !dir.equals(template.dir) : template.dir != null) return false;
+        if (name != null ? !name.equals(template.name) : template.name != null) return false;
+        if (theme != null ? !theme.equals(template.theme) : template.theme != null) return
false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = dir != null ? dir.hashCode() : 0;
+        result = 31 * result + (theme != null ? theme.hashCode() : 0);
+        result = 31 * result + (name != null ? name.hashCode() : 0);
+        return result;
+    }
+
 }


Mime
View raw message