diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-24 13:50:21 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-24 13:50:21 +0100 |
commit | df9e488fe8c877931155916bb76932caeaeef897 (patch) | |
tree | fcb7ba20e095dcebc680e66009cb76465309181a /sonar-plugin-api/src/main | |
parent | f2b796849290393c75a3b52bf51dbb544da0d3dd (diff) | |
download | sonarqube-df9e488fe8c877931155916bb76932caeaeef897.tar.gz sonarqube-df9e488fe8c877931155916bb76932caeaeef897.zip |
SONAR-5056 Remove useless static creation methods
Diffstat (limited to 'sonar-plugin-api/src/main')
2 files changed, 5 insertions, 18 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunction.java index a5bda3a8f25..dedf5a3e60c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunction.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunction.java @@ -35,7 +35,7 @@ class DefaultDebtRemediationFunction implements DebtRemediationFunction { private String factor; private String offset; - private DefaultDebtRemediationFunction(Type type, @Nullable String factor, @Nullable String offset) { + public DefaultDebtRemediationFunction(Type type, @Nullable String factor, @Nullable String offset) { this.type = type; // TODO validate factor and offset format this.factor = StringUtils.deleteWhitespace(factor); @@ -43,31 +43,18 @@ class DefaultDebtRemediationFunction implements DebtRemediationFunction { validate(); } - static DebtRemediationFunction create(Type type, @Nullable String factor, @Nullable String offset) { - return new DefaultDebtRemediationFunction(type, factor, offset); - } - - static DebtRemediationFunction createLinear(String factor) { - return new DefaultDebtRemediationFunction(Type.LINEAR, factor, null); - } - - static DebtRemediationFunction createLinearWithOffset(String factor, String offset) { - return new DefaultDebtRemediationFunction(Type.LINEAR_OFFSET, factor, offset); - } - - static DebtRemediationFunction createConstantPerIssue(String offset) { - return new DefaultDebtRemediationFunction(Type.CONSTANT_ISSUE, null, offset); - } - + @Override public Type type() { return type; } + @Override @CheckForNull public String factor() { return factor; } + @Override @CheckForNull public String offset() { return offset; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java index 3c529e73b57..befa7907095 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java @@ -50,7 +50,7 @@ class DefaultDebtRemediationFunctions implements DebtRemediationFunctions { private DebtRemediationFunction create(DefaultDebtRemediationFunction.Type type, @Nullable String factor, @Nullable String offset) { try { - return DefaultDebtRemediationFunction.create(type, factor, offset); + return new DefaultDebtRemediationFunction(type, factor, offset); } catch (DefaultDebtRemediationFunction.ValidationException e) { throw MessageException.of(String.format("The rule '%s:%s' is invalid : %s ", this.repoKey, this.key, e.getMessage())); } |