diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-01 13:18:53 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-01 13:18:53 +0000 |
commit | ebfadacd34d9c6d83bd91d5d688b10929eed7417 (patch) | |
tree | 03f27e16ae6e956a444202122f804a6a54327bde /sonar-plugin-api/src | |
parent | 5ff37187a4c28c76182254b0f31c935cc165f3ae (diff) | |
download | sonarqube-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.java | 14 |
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) { |