/** * Gets whether validation for the binder passed or not. * * @return {@code true} if validation has passed, {@code false} if not */ public boolean isOk() { return !hasErrors(); }
/** * Writes changes from the bound fields to the given bean if all validators * (binding and bean level) pass. * <p> * If any field binding validator fails, no values are written and a * {@code ValidationException} is thrown. * <p> * If all field level validators pass, the given bean is updated and bean * level validators are run on the updated bean. If any bean level validator * fails, the bean updates are reverted and a {@code ValidationException} is * thrown. * * @see #writeBeanIfValid(Object) * @see #readBean(Object) * @see #setBean(Object) * * @param bean * the object to which to write the field values, not * {@code null} * @throws ValidationException * if some of the bound field values fail to validate */ public void writeBean(BEAN bean) throws ValidationException { BinderValidationStatus<BEAN> status = doWriteIfValid(bean, new ArrayList<>(bindings)); if (status.hasErrors()) { throw new ValidationException(status.getFieldValidationErrors(), status.getBeanValidationErrors()); } }
fireStatusChangeEvent(validationStatus.hasErrors());