mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 21:48:22 +02:00
support double value validation
This commit is contained in:
@@ -96,6 +96,7 @@ public class Validator {
|
||||
checkInteger(columnConfig, value, error);
|
||||
checkGroovy(column, columnConfig, value, error);
|
||||
checkValueOf(columnConfig, value, error);
|
||||
checkDouble(columnConfig, value, error);
|
||||
}
|
||||
|
||||
if (!error.isEmpty()) {
|
||||
@@ -174,6 +175,15 @@ public class Validator {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDouble(Config columnConfig, String value, ValidationError error) {
|
||||
if (getBoolean(columnConfig, "double")) {
|
||||
if (!isDouble(value)) {
|
||||
error.add("validation.message.double");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkMinLength(Config columnConfig, String value, ValidationError error) {
|
||||
Integer minLength = getInteger(columnConfig, "minlength");
|
||||
if (minLength != null) {
|
||||
|
||||
@@ -12,6 +12,7 @@ title.validation.errors = Validation Errors:
|
||||
# validaton messages
|
||||
validation.message.not.empty = should not be empty
|
||||
validation.message.integer = should be an integer
|
||||
validation.message.double = should be a double
|
||||
validation.message.alphanumeric = should be alphanumeric
|
||||
validation.message.groovy.exception = groovy script '{0}' throws exception: {1}
|
||||
validation.message.groovy.return.null = groovy script '{0}' returns null
|
||||
|
||||
@@ -20,6 +20,7 @@ title.validation.errors = Fehler in der Datei:
|
||||
# validaton messages
|
||||
validation.message.not.empty = Darf nicht leer sein.
|
||||
validation.message.integer = Muss eine Zahl sein.
|
||||
validation.message.double = Muss eine Gleitkommazahl sein
|
||||
validation.message.alphanumeric = Darf nur Zahlen und Buchstaben enthalten.
|
||||
validation.message.groovy.exception = groovy script '{0}' wirft folgenden Fehler: {1}
|
||||
validation.message.groovy.return.null = groovy script '{0}' meldet "null"
|
||||
|
||||
Reference in New Issue
Block a user