/*
* Copyright 2000-2022 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.data.validator;
import java.io.Serializable;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.MessageInterpolator.Context;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import javax.validation.metadata.ConstraintDescriptor;
import com.vaadin.data.ValidationResult;
import com.vaadin.data.Validator;
import com.vaadin.data.ValueContext;
import com.vaadin.data.util.BeanUtil;
/**
* A {@code Validator} using the JSR-303 (javax.validation) annotation-based
* bean validation mechanism. Values passed to this validator are compared
* against the constraints, if any, specified by annotations on the
* corresponding bean property.
*
* Note that a JSR-303 implementation (for instance
* Hibernate Validator or
* Apache BVal) must be present on the
* project classpath when using bean validation. Specification versions 1.0 and
* 1.1 are supported.
*
* @author Vaadin Ltd.
*
* @since 8.0
*/
public class BeanValidator implements Validator