aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2012-02-03 11:56:29 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2012-02-03 13:04:13 +0400
commitddbe2f2a71212a98843ca9655f594ba34bf45ea6 (patch)
tree930764c571a3fcb1453078de6c09233b147bd568 /sonar-plugin-api
parentee89433c1d1db971c046c695d99ab1c72b265ba3 (diff)
downloadsonarqube-ddbe2f2a71212a98843ca9655f594ba34bf45ea6.tar.gz
sonarqube-ddbe2f2a71212a98843ca9655f594ba34bf45ea6.zip
SONAR-3231 Allow to associate measure with committer
* Fix hashCode and equals for RuleMeasure * Add RuleMeasure.getSeverity()
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java46
1 files changed, 30 insertions, 16 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java
index 923aea5f006..0da76ee17f2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java
@@ -51,11 +51,22 @@ 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.
*/
public RuleMeasure setRulePriority(RulePriority rulePriority) {
@@ -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) {