if (violations.isEmpty()) {
return true;
} else {
for (ConstraintViolation violation : violations) {
if (violation.getContext() instanceof FieldContext) {
final FieldContext ctx = (FieldContext) violation.getContext();
final String fkey = (key == null ? "" : key + ".") + ctx.getField().getName();
final Error error = new Error(fkey, violation.getMessage(), violation.getMessageVariables() == null ? new String[0] : violation.getMessageVariables().values().toArray(new String[0]));
Validation.current().errors.add(error);
}
}
return false;