aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-10-01 13:18:53 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-10-01 13:18:53 +0000
commitebfadacd34d9c6d83bd91d5d688b10929eed7417 (patch)
tree03f27e16ae6e956a444202122f804a6a54327bde /sonar-plugin-api/src
parent5ff37187a4c28c76182254b0f31c935cc165f3ae (diff)
downloadsonarqube-ebfadacd34d9c6d83bd91d5d688b10929eed7417.tar.gz
sonarqube-ebfadacd34d9c6d83bd91d5d688b10929eed7417.zip
quality model API: add the methods Characteristic.hasRule() and getProperties()
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java
index 8555dbd0b22..f61cc3ad6aa 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java
@@ -20,6 +20,7 @@
package org.sonar.api.qualitymodel;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
@@ -30,6 +31,7 @@ import org.sonar.api.rules.Rule;
import javax.persistence.*;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
/**
* @since 2.3
@@ -134,6 +136,10 @@ public final class Characteristic implements Comparable<Characteristic> {
return rule;
}
+ public boolean hasRule() {
+ return rule!=null;
+ }
+
public Characteristic setRule(Rule r) {
this.rule = r;
return this;
@@ -272,6 +278,14 @@ public final class Characteristic implements Comparable<Characteristic> {
return property != null ? property.getValueAsDouble() : null;
}
+ public Map<String,String> getProperties() {
+ Map<String,String> map = Maps.newTreeMap();
+ for (CharacteristicProperty property : properties) {
+ map.put(property.getKey(), property.getValue());
+ }
+ return map;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {