com.vaadin.data.validator.BeanValidator Maven / Gradle / Ivy
/*
* Copyright (C) 2000-2024 Vaadin Ltd
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See for the full
* 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