mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 21:48:22 +02:00
first version of new validation algorithm, that is a lot faster
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package ninja.javafx.smartcsv.validation;
|
||||
|
||||
import static org.apache.commons.validator.GenericValidator.maxLength;
|
||||
|
||||
/**
|
||||
* Created by abi on 07.08.2016.
|
||||
*/
|
||||
public class MaxLengthValidation implements Validation {
|
||||
|
||||
private int maxLength;
|
||||
|
||||
public MaxLengthValidation(int maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void check(int row, String value, ValidationError error) {
|
||||
if (!maxLength(value, maxLength)) {
|
||||
error.add("validation.message.max.length", Integer.toString(maxLength));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return Type.MAX_LENGTH;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user