Closed NBau closed 6 years ago
As a first step, I've added a public method to get the constraint violations (4b0f766edcd782b53ec6af1b5b2da41c01d0d4a1).
So you can get the field level conversion and validation errors using:
binder.getBindings().stream().map(e -> e.validate()).collect(Collectors.toList()),
And the bean level validation errors using:
binder.getConstraintViolations().stream().filter(e -> e.getPropertyPath().toString().equals("")) .map(e -> ValidationResult.error(e.getMessage())).collect(Collectors.toList()));
Or, alternatively, use the BinderAdapter that exposes a Binder compatible interface including BinderValidationStatus handling.
I'll try to add some logic similar to the BinderValidationStatus handling in Binder to BasicBinder in the near future.
Excellent. Thank you for the quick reply and the good work.
Part of release 0.5
currently it is not possible to get the list of error messages from a binder or a notification. As far as I can see, the BasicBinder has all ConstraintViolations (but not accessible from the outside) and the bindings each store conversion and validation error messages. Ideally, the BinderStatusChangeEvent would carry the actual error messages and they would also be accessibe from the binder in an accumulated way.