Validator<Person> validator = new Validator<>();
validator.ruleFor(Person::getName)
.notEmpty()
.length(5, 20)
ValidationResult result = validator.validate(person);
if (result.isValid()) {
} else {
}
if (!result.isValid()) {
List<String> errors = result.errors();
for (String error : errors) {
System.out.println(error);
}
result.onError((property, errorMessage) -> {
});
}