From 3b7190f675661814bc8619a2c8f341db298dce15 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 4 Jan 2013 21:23:39 +0100 Subject: [PATCH] added equals, hashCode and toString methods to Plugin class --- .../main/java/sonia/scm/plugin/Plugin.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/plugin/Plugin.java b/scm-core/src/main/java/sonia/scm/plugin/Plugin.java index 0b5a13dbe2..8c1a45298c 100644 --- a/scm-core/src/main/java/sonia/scm/plugin/Plugin.java +++ b/scm-core/src/main/java/sonia/scm/plugin/Plugin.java @@ -33,6 +33,10 @@ package sonia.scm.plugin; +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; + //~--- JDK imports ------------------------------------------------------------ import java.util.Set; @@ -53,6 +57,71 @@ import javax.xml.bind.annotation.XmlTransient; public class Plugin { + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final Plugin other = (Plugin) obj; + + return Objects.equal(condition, other.condition) + && Objects.equal(information, other.information) + && Objects.equal(packageSet, other.packageSet) + && Objects.equal(path, other.path) + && Objects.equal(resources, other.resources); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(condition, information, packageSet, packageSet, + resources); + } + + /** + * Method description + * + * + * @return + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("condition", condition) + .add("information", information) + .add("packageSet", packageSet) + .add("path", path) + .add("resources", resources) + .toString(); + //J+ + } + + //~--- get methods ---------------------------------------------------------- + /** * Method description *