Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2022 Archie L. Cobbs. All rights reserved.
*/
package org.dellroad.stuff.vaadin24.util;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.data.binder.ValidationResult;
import com.vaadin.flow.data.binder.Validator;
import com.vaadin.flow.data.binder.ValueContext;
import com.vaadin.flow.data.validator.BeanValidator;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Path;
import jakarta.validation.TraversableResolver;
import jakarta.validation.Valid;
import jakarta.validation.ValidatorFactory;
import jakarta.validation.groups.Default;
import java.lang.annotation.ElementType;
import java.util.Locale;
import java.util.Optional;
import org.dellroad.stuff.vaadin24.field.ValidatingBean;
/**
* Applies JSR 303 bean validation constraints that are attached to the bean as a whole (not to an individual property).
*
*
* The {@link BeanValidator} class validates individual bean properties but does not handle "whole bean" validation
* constraints. This class can be used to cover that gap. This validator does not recurse on the properties
* of the bean (for that, annotate those properties with {@link Valid @Valid} and rely on {@link BeanValidator}
* per-property validation).
*
*
* See {@link ValidatingBean} for a simpler, non-JSR 303 alternative to this class.
*
*
* This is a bean-level validator, so any {@link Binder} using this validator will need access to an actual bean in order
* to validate (e.g., via {@link Binder#setBean Binder.setBean()}, {@link Binder#writeBean Binder.writeBean()},
* {@link Binder#writeBeanIfValid Binder.writeBeanIfValid()}, etc.), otherwise you'll get an {@link IllegalStateException}
* with bean level validators have been configured but no bean is currently set.
*
* @see ValidatingBean
* @see Binder#withValidator(Validator) Binder.withValidator()
*/
@SuppressWarnings("serial")
public class WholeBeanValidator implements Validator