]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3231 Allow to associate measure with committer
authorEvgeny Mandrikov <mandrikov@gmail.com>
Fri, 3 Feb 2012 07:56:29 +0000 (11:56 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Fri, 3 Feb 2012 09:04:13 +0000 (13:04 +0400)
* Fix hashCode and equals for RuleMeasure
* Add RuleMeasure.getSeverity()

sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java

index 923aea5f0061af632845876656b5b31c6e68c170..0da76ee17f28c904e5740e875ac5a2787e38937b 100644 (file)
@@ -51,10 +51,21 @@ public class RuleMeasure extends Measure {
     return this;
   }
 
+  /**
+   * @deprecated since 2.14 use {@link #getSeverity()} instead. See SONAR-1829.
+   */
+  @Deprecated
   public RulePriority getRulePriority() {
     return rulePriority;
   }
 
+  /**
+   * @since 2.14
+   */
+  public RulePriority getSeverity() {
+    return rulePriority;
+  }
+
   /**
    * @deprecated since 2.14 use {@link #setSeverity()} instead. See SONAR-1829.
    */
@@ -101,6 +112,7 @@ public class RuleMeasure extends Measure {
     RuleMeasure other = (RuleMeasure) obj;
     return new EqualsBuilder()
       .append(getMetric(), other.getMetric())
+      .append(committer, other.committer)
       .append(rule, other.rule)
       .isEquals();
   }
@@ -112,26 +124,28 @@ public class RuleMeasure extends Measure {
 
   @Override
   public int hashCode() {
-    return new HashCodeBuilder(17, 37).
-      append(getMetric()).
-      append(rule).
-      toHashCode();
+    return new HashCodeBuilder(17, 37)
+      .append(getMetric())
+      .append(committer)
+      .append(rule)
+      .toHashCode();
   }
 
   @Override
   public String toString() {
-    return new ToStringBuilder(this).
-      append("id", getId()).
-      append("metric", metric).
-      append("rule", rule).
-      append("value", value).
-      append("data", data).
-      append("description", description).
-      append("alertStatus", alertStatus).
-      append("alertText", alertText).
-      append("tendency", tendency).
-      append("severity", rulePriority).
-      toString();
+    return new ToStringBuilder(this)
+      .append("id", getId())
+      .append("metric", metric)
+      .append("committer", committer)
+      .append("rule", rule)
+      .append("value", value)
+      .append("data", data)
+      .append("description", description)
+      .append("alertStatus", alertStatus)
+      .append("alertText", alertText)
+      .append("tendency", tendency)
+      .append("severity", rulePriority)
+      .toString();
   }
 
   public static RuleMeasure createForRule(Metric metric, Rule rule, Double value) {