Search in sources :

Example 1 with RangeValidator

use of org.ow2.proactive.scheduler.common.job.factories.spi.model.validator.RangeValidator in project scheduling by ow2-proactive.

the class RangeParserValidator method createValidator.

@Override
protected Validator<T> createValidator(String model, Converter<T> converter) throws ModelSyntaxException {
    if (model.matches(getTypeRegexp())) {
        return new RangeValidator();
    }
    String mainRangeRegexp = "^" + getTypeRegexp() + RANGE_MAIN_REGEXP + "$";
    String rangeString = parseAndGetOneGroup(model, mainRangeRegexp);
    try {
        return new RangeValidator<>(extractRange(rangeString, converter));
    } catch (IllegalArgumentException e) {
        throw new ModelSyntaxException(e.getMessage(), e);
    }
}
Also used : ModelSyntaxException(org.ow2.proactive.scheduler.common.job.factories.spi.model.exceptions.ModelSyntaxException) RangeValidator(org.ow2.proactive.scheduler.common.job.factories.spi.model.validator.RangeValidator)

Aggregations

ModelSyntaxException (org.ow2.proactive.scheduler.common.job.factories.spi.model.exceptions.ModelSyntaxException)1 RangeValidator (org.ow2.proactive.scheduler.common.job.factories.spi.model.validator.RangeValidator)1