From 671e9a54077bcb109572322f67bf93d54785570d Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 15 Oct 2014 12:39:49 +0200 Subject: [PATCH] [sonar] 'equals(Object obj)' should be overridden along with the 'compareTo(T obj)' method --- .../easyrules/core/AnnotatedRulesEngine.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/easyrules-core/src/main/java/org/easyrules/core/AnnotatedRulesEngine.java b/easyrules-core/src/main/java/org/easyrules/core/AnnotatedRulesEngine.java index 24ef6b4..4c9225a 100644 --- a/easyrules-core/src/main/java/org/easyrules/core/AnnotatedRulesEngine.java +++ b/easyrules-core/src/main/java/org/easyrules/core/AnnotatedRulesEngine.java @@ -303,6 +303,26 @@ public class AnnotatedRulesEngine extends AbstractRulesEngine { } } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ActionMethodBean)) return false; + + ActionMethodBean that = (ActionMethodBean) o; + + if (order != that.order) return false; + if (!method.equals(that.method)) return false; + + return true; + } + + @Override + public int hashCode() { + int result = method.hashCode(); + result = 31 * result + order; + return result; + } + } /** @@ -338,6 +358,26 @@ public class AnnotatedRulesEngine extends AbstractRulesEngine { } } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof RuleBean)) return false; + + RuleBean ruleBean = (RuleBean) o; + + if (priority != ruleBean.priority) return false; + if (!rule.equals(ruleBean.rule)) return false; + + return true; + } + + @Override + public int hashCode() { + int result = priority; + result = 31 * result + rule.hashCode(); + return result; + } + } }