use of io.atlasmap.v2.Validations in project atlasmap by atlasmap.
the class NotEmptyValidator method validate.
@Override
public void validate(Object target, List<Validation> validations, String id, ValidationStatus status) {
if (!supports(target)) {
return;
}
if (((Collection<?>) target).isEmpty()) {
Validation validation = new Validation();
validation.setScope(scope);
validation.setId(id);
validation.setMessage(this.violationMessage);
validation.setStatus(status);
validations.add(validation);
}
}
use of io.atlasmap.v2.Validations in project atlasmap by atlasmap.
the class PositiveIntegerValidator method validate.
@Override
public void validate(Object target, List<Validation> validations, String id, ValidationStatus status) {
Integer value = (Integer) target;
if (value == null || value < 0) {
Validation validation = new Validation();
validation.setScope(scope);
validation.setId(id);
validation.setMessage(String.format(violationMessage, target != null ? target.toString() : null));
validation.setStatus(status);
validations.add(validation);
}
}
Aggregations