mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
reorganized storage of models
This commit is contained in:
@@ -36,8 +36,7 @@ import java.io.IOException;
|
||||
/**
|
||||
* This class loads the constraints as json config
|
||||
*/
|
||||
@Service
|
||||
public class ValidationFileReader implements FileReader {
|
||||
public class ValidationFileReader implements FileReader<ValidationConfiguration> {
|
||||
|
||||
private ValidationConfiguration config;
|
||||
|
||||
@@ -46,7 +45,7 @@ public class ValidationFileReader implements FileReader {
|
||||
config = new GsonBuilder().create().fromJson(new java.io.FileReader(file), ValidationConfiguration.class);
|
||||
}
|
||||
|
||||
public ValidationConfiguration getValidationConfiguration() {
|
||||
public ValidationConfiguration getContent() {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,12 +38,11 @@ import java.nio.file.Files;
|
||||
/**
|
||||
* file writer for the validation configuration
|
||||
*/
|
||||
@Service
|
||||
public class ValidationFileWriter implements FileWriter {
|
||||
public class ValidationFileWriter implements FileWriter<ValidationConfiguration> {
|
||||
|
||||
private ValidationConfiguration validationConfiguration;
|
||||
|
||||
public void setValidationConfiguration(ValidationConfiguration validationConfiguration) {
|
||||
public void setContent(ValidationConfiguration validationConfiguration) {
|
||||
this.validationConfiguration = validationConfiguration;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class Validator {
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// oublic methods
|
||||
// public methods
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ public class Validator {
|
||||
*/
|
||||
public ValidationError isValid(String column, String value, Integer lineNumber) {
|
||||
ValidationError result = null;
|
||||
if (validationConfig != null) {
|
||||
if (hasConfig()) {
|
||||
|
||||
ValidationError error = ValidationError.withLineNumber(lineNumber);
|
||||
checkBlankOrNull(column, value, error);
|
||||
@@ -101,6 +101,9 @@ public class Validator {
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean hasConfig() {
|
||||
return validationConfig != null;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// private methods
|
||||
|
||||
Reference in New Issue
Block a user