diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2017-02-10 11:34:45 +0100 |
---|---|---|
committer | dbmeneses <duarte.meneses@sonarsource.com> | 2017-02-10 14:53:39 +0100 |
commit | 1381a0f867a089907b666a5024b1343d3ddadc75 (patch) | |
tree | ca76e7b505f7b4a7deca410226f2c865a335d2dc /sonar-plugin-api | |
parent | 7449add1d743a42185d8906683190a843f4462fd (diff) | |
download | sonarqube-1381a0f867a089907b666a5024b1343d3ddadc75.tar.gz sonarqube-1381a0f867a089907b666a5024b1343d3ddadc75.zip |
Add type to internal DefaultRule
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java | 7 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java index 5a6d0117200..f216f042606 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java @@ -39,6 +39,7 @@ public class DefaultRule implements Rule { private final Integer id; private final String name; private final String severity; + private final String type; private final String description; private final String internalKey; private final RuleStatus status; @@ -49,6 +50,7 @@ public class DefaultRule implements Rule { this.id = newRule.id; this.name = newRule.name; this.severity = newRule.severity; + this.type = newRule.type; this.description = newRule.description; this.internalKey = newRule.internalKey; this.status = newRule.status; @@ -80,6 +82,11 @@ public class DefaultRule implements Rule { return severity; } + @CheckForNull + public String type() { + return type; + } + @Override public String description() { return description; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java index 70fded597b9..395d5e18146 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java @@ -37,6 +37,7 @@ public class NewRule { String name; String description; String severity = DEFAULT_SEVERITY; + String type; String internalKey; RuleStatus status = RuleStatus.defaultStatus(); Map<String, NewRuleParam> params = new HashMap<>(); @@ -64,6 +65,11 @@ public class NewRule { this.severity = StringUtils.defaultIfBlank(severity, DEFAULT_SEVERITY); return this; } + + public NewRule setType(@Nullable String type) { + this.type = type; + return this; + } public NewRule setStatus(@Nullable RuleStatus s) { this.status = (RuleStatus) ObjectUtils.defaultIfNull(s, RuleStatus.defaultStatus()); |