org.holmes.ValidationResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of holmes-validation Show documentation
Show all versions of holmes-validation Show documentation
Holmes is a library that provides a simple and fluent API for writing business rules validations on Java projects.
The newest version!
package org.holmes;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* Class that holds the result of a validation.
*
* @author diegossilveira
*/
public class ValidationResult {
private final Set violationsDescriptors;
private ValidationResult() {
violationsDescriptors = new LinkedHashSet();
}
static ValidationResult init() {
return new ValidationResult();
}
public void addViolationDescriptor(String violationDescriptor) {
if (violationDescriptor != null) {
violationsDescriptors.add(violationDescriptor);
}
}
public boolean hasViolations() {
return !violationsDescriptors.isEmpty();
}
public Set getViolationsDescriptors() {
return Collections.unmodifiableSet(violationsDescriptors);
}
@Override
public String toString() {
return violationsDescriptors.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy