summaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-03-15 13:22:37 +0300
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-03-15 21:44:17 +0300
commitae5bf064b6a59b81263d83a28e9d0462c7e26c65 (patch)
tree31e28ab4754b3e55411afc88540582c61fd309c1 /sonar-plugin-api/src
parent1dc4a0e9e0d670381be01d1edce0596a66f62c21 (diff)
downloadsonarqube-ae5bf064b6a59b81263d83a28e9d0462c7e26c65.tar.gz
sonarqube-ae5bf064b6a59b81263d83a28e9d0462c7e26c65.zip
SONAR-2228 Fix equals and hashCode for ActiveRuleParam
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java24
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java24
2 files changed, 24 insertions, 24 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java
index 56526ba2e9d..260c854603a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java
@@ -19,16 +19,19 @@
*/
package org.sonar.api.rules;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
@Entity
@Table(name = "active_rule_parameters")
public class ActiveRuleParam implements Cloneable {
-
@Id
@Column(name = "id")
@GeneratedValue
@@ -112,22 +115,19 @@ public class ActiveRuleParam implements Cloneable {
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof RuleParam)) {
+ if (!(obj instanceof ActiveRuleParam)) {
return false;
}
if (this == obj) {
return true;
}
- RuleParam other = (RuleParam) obj;
- return new EqualsBuilder()
- .append(getId(), other.getKey()).isEquals();
+ ActiveRuleParam other = (ActiveRuleParam) obj;
+ return other.getKey().equals(getKey());
}
@Override
public int hashCode() {
- return new HashCodeBuilder(17, 37)
- .append(getId())
- .toHashCode();
+ return getKey().hashCode();
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java
index 5afc350344d..edb6690aef7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java
@@ -20,11 +20,16 @@
package org.sonar.api.rules;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
@Entity
@Table(name = "rules_parameters")
@@ -110,14 +115,14 @@ public class RuleParam {
}
public Boolean getDefaultValueAsBoolean() {
- if (defaultValue!=null) {
+ if (defaultValue != null) {
return Boolean.parseBoolean(defaultValue);
}
return null;
}
public Integer getDefaultValueAsInteger() {
- if (defaultValue!=null) {
+ if (defaultValue != null) {
return Integer.parseInt(defaultValue);
}
return null;
@@ -137,17 +142,12 @@ public class RuleParam {
return true;
}
RuleParam other = (RuleParam) obj;
- return new EqualsBuilder()
- //.append(rule, other.getRule())
- .append(key, other.getKey()).isEquals();
+ return other.key.equals(key);
}
@Override
public int hashCode() {
- return new HashCodeBuilder(17, 37)
- //.append(rule)
- .append(key)
- .toHashCode();
+ return key.hashCode();
}
@Override