diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-06-10 15:31:52 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-06-10 15:31:52 +0200 |
commit | 7229de6b303f8962ade62410664b669835c62632 (patch) | |
tree | 3f052063e4107f1ce9305174197e8371e6b4738a /sonar-plugin-api/src | |
parent | 44103f1921fc4b1900b8b6047e865c1e49f325d6 (diff) | |
download | sonarqube-7229de6b303f8962ade62410664b669835c62632.tar.gz sonarqube-7229de6b303f8962ade62410664b669835c62632.zip |
Set list of status as constant
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java index 7bc4e18671c..71c4e9f3a4f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java @@ -62,6 +62,12 @@ public final class Rule { */ public static final String STATUS_REMOVED = "REMOVED"; + /** + * List of available status + * @since 3.6 + */ + private static final Set<String> STATUS_LIST = ImmutableSet.of(STATUS_READY, STATUS_BETA, STATUS_DEPRECATED, STATUS_REMOVED); + @Id @Column(name = "id") @@ -82,7 +88,6 @@ public final class Rule { @Column(name = "plugin_config_key", updatable = true, nullable = true, length = 500) private String configKey; - // Godin: This field should be named priority, otherwise StandardRulesXmlParserTest fails @Column(name = "priority", updatable = true, nullable = true) @Enumerated(EnumType.ORDINAL) private RulePriority priority = DEFAULT_PRIORITY; @@ -124,7 +129,7 @@ public final class Rule { */ @Deprecated public Rule() { - // TODO reduce visibility to package + // TODO reduce visibility to packaete } /** @@ -405,8 +410,8 @@ public final class Rule { * @since 3.6 */ public Rule setStatus(String status) { - if (!getStatusList().contains(status)) { - throw new SonarException("The status of a rule can only contain : " + Joiner.on(", ").join(getStatusList())); + if (!STATUS_LIST.contains(status)) { + throw new SonarException("The status of a rule can only contain : " + Joiner.on(", ").join(STATUS_LIST)); } this.status = status; return this; @@ -529,13 +534,6 @@ public final class Rule { /** * @since 3.6 */ - public static Set<String> getStatusList() { - return ImmutableSet.of(STATUS_READY, STATUS_BETA, STATUS_DEPRECATED, STATUS_REMOVED); - } - - /** - * @since 3.6 - */ public RuleKey ruleKey() { return RuleKey.of(getRepositoryKey(), getKey()); } |