mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
28 lines
605 B
Java
28 lines
605 B
Java
package ninja.javafx.smartcsv.validation;
|
|
|
|
import static org.apache.commons.validator.GenericValidator.matchRegexp;
|
|
|
|
/**
|
|
* Created by abi on 07.08.2016.
|
|
*/
|
|
public class RegExpValidation implements Validation {
|
|
|
|
private String regexp;
|
|
|
|
public RegExpValidation(String regexp) {
|
|
this.regexp = regexp;
|
|
}
|
|
|
|
@Override
|
|
public void check(int row, String value, ValidationError error) {
|
|
if (!matchRegexp(value, regexp)) {
|
|
error.add("validation.message.regexp", regexp);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public Type getType() {
|
|
return Type.REGEXP;
|
|
}
|
|
}
|