Search in sources :

Example 1 with RuleParamType

use of org.sonar.api.server.rule.RuleParamType in project sonarqube by SonarSource.

the class RuleCreator method validateParam.

private void validateParam(RuleParamDto ruleParam, @Nullable String value) {
    if (value != null) {
        RuleParamType ruleParamType = RuleParamType.parse(ruleParam.getType());
        if (ruleParamType.multiple()) {
            List<String> values = newArrayList(Splitter.on(",").split(value));
            typeValidations.validate(values, ruleParamType.type(), ruleParamType.values());
        } else {
            typeValidations.validate(value, ruleParamType.type(), ruleParamType.values());
        }
    }
}
Also used : RuleParamType(org.sonar.api.server.rule.RuleParamType)

Example 2 with RuleParamType

use of org.sonar.api.server.rule.RuleParamType in project sonarqube by SonarSource.

the class RuleActivator method validateParam.

@CheckForNull
private String validateParam(RuleParamDto ruleParam, @Nullable String value) {
    if (value != null) {
        RuleParamType ruleParamType = RuleParamType.parse(ruleParam.getType());
        if (ruleParamType.multiple()) {
            List<String> values = newArrayList(Splitter.on(",").split(value));
            typeValidations.validate(values, ruleParamType.type(), ruleParamType.values());
        } else {
            typeValidations.validate(value, ruleParamType.type(), ruleParamType.values());
        }
    }
    return value;
}
Also used : RuleParamType(org.sonar.api.server.rule.RuleParamType) CheckForNull(javax.annotation.CheckForNull)

Example 3 with RuleParamType

use of org.sonar.api.server.rule.RuleParamType in project sonarqube by SonarSource.

the class RuleActivator method validateParam.

@CheckForNull
private String validateParam(RuleParamDto ruleParam, @Nullable String value) {
    if (value != null) {
        RuleParamType ruleParamType = RuleParamType.parse(ruleParam.getType());
        if (ruleParamType.multiple()) {
            List<String> values = Splitter.on(",").splitToList(value);
            typeValidations.validate(values, ruleParamType.type(), ruleParamType.values());
        } else {
            typeValidations.validate(value, ruleParamType.type(), ruleParamType.values());
        }
    }
    return value;
}
Also used : RuleParamType(org.sonar.api.server.rule.RuleParamType) CheckForNull(javax.annotation.CheckForNull)

Example 4 with RuleParamType

use of org.sonar.api.server.rule.RuleParamType in project sonarqube by SonarSource.

the class BuiltInQProfileInsertImpl method validateParam.

private String validateParam(RuleParamDto ruleParam, String value) {
    RuleParamType ruleParamType = RuleParamType.parse(ruleParam.getType());
    if (ruleParamType.multiple()) {
        List<String> values = newArrayList(Splitter.on(",").split(value));
        typeValidations.validate(values, ruleParamType.type(), ruleParamType.values());
    } else {
        typeValidations.validate(value, ruleParamType.type(), ruleParamType.values());
    }
    return value;
}
Also used : RuleParamType(org.sonar.api.server.rule.RuleParamType)

Aggregations

RuleParamType (org.sonar.api.server.rule.RuleParamType)4 CheckForNull (javax.annotation.CheckForNull)2