aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
index 391cc49eb99..b5f423c257e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
@@ -20,17 +20,19 @@
package org.sonar.api.measures;
import com.google.common.annotations.Beta;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.Date;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.math.NumberUtils;
import org.sonar.api.technicaldebt.batch.Characteristic;
import org.sonar.api.technicaldebt.batch.Requirement;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Date;
+
/**
* A class to handle measures.
*
@@ -60,6 +62,8 @@ public class Measure<G extends Serializable> implements Serializable {
protected Double variation4;
protected Double variation5;
protected String url;
+ protected Characteristic characteristic;
+ protected Requirement requirement;
protected Integer personId;
protected PersistenceMode persistenceMode = PersistenceMode.FULL;
private boolean fromCore;
@@ -627,13 +631,14 @@ public class Measure<G extends Serializable> implements Serializable {
*/
@CheckForNull
public final Characteristic getCharacteristic() {
- return null;
+ return characteristic;
}
/**
* @since 4.1
*/
public final Measure<G> setCharacteristic(@Nullable Characteristic characteristic) {
+ this.characteristic = characteristic;
return this;
}
@@ -644,7 +649,7 @@ public class Measure<G extends Serializable> implements Serializable {
@Deprecated
@CheckForNull
public final Requirement getRequirement() {
- return null;
+ return requirement;
}
/**
@@ -653,6 +658,7 @@ public class Measure<G extends Serializable> implements Serializable {
*/
@Deprecated
public final Measure<G> setRequirement(@Nullable Requirement requirement) {
+ this.requirement = requirement;
return this;
}
@@ -731,12 +737,16 @@ public class Measure<G extends Serializable> implements Serializable {
if (metricKey != null ? !metricKey.equals(measure.metricKey) : (measure.metricKey != null)) {
return false;
}
+ if (characteristic != null ? !characteristic.equals(measure.characteristic) : (measure.characteristic != null)) {
+ return false;
+ }
return !(personId != null ? !personId.equals(measure.personId) : (measure.personId != null));
}
@Override
public int hashCode() {
int result = metricKey != null ? metricKey.hashCode() : 0;
+ result = 31 * result + (characteristic != null ? characteristic.hashCode() : 0);
result = 31 * result + (personId != null ? personId.hashCode() : 0);
return result;
}