Interface CascadingPropertyValidator

  • All Superinterfaces:
    jakarta.validation.Validator
    All Known Implementing Classes:
    ValidatorImpl

    public interface CascadingPropertyValidator
    extends jakarta.validation.Validator
    Per the bean validation spec, Valid is not honored by the validateProperty(Object, String, Class...) and validateValue(Class, String, Object, Class...) methods. The CascadingPropertyValidator interface thus defines a Validator that provides corresponding methods that may honor Valid. It should be noted that Validator.validateProperty(Object, String, Class...) and Validator.validateValue(Class, String, Object, Class...) are assumed semantically equivalent to calling the CascadingPropertyValidator-defined methods with cascade == false.
    Version:
    $Rev: 993539 $ $Date: 2010-09-07 16:27:50 -0500 (Tue, 07 Sep 2010) $
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      <T> Set<jakarta.validation.ConstraintViolation<T>> validateProperty​(T object, String propertyName, boolean cascade, Class<?>... groups)
      Validates all constraints placed on the property of object named propertyName.
      default <T> Set<jakarta.validation.ConstraintViolation<T>> validateProperty​(T object, String propertyName, Class<?>... groups)
      Validates all constraints placed on the property of object named propertyName.
      <T> Set<jakarta.validation.ConstraintViolation<T>> validateValue​(Class<T> beanType, String propertyName, Object value, boolean cascade, Class<?>... groups)
      Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.
      default <T> Set<jakarta.validation.ConstraintViolation<T>> validateValue​(Class<T> beanType, String propertyName, Object value, Class<?>... groups)
      Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.
      • Methods inherited from interface jakarta.validation.Validator

        forExecutables, getConstraintsForClass, unwrap, validate
    • Method Detail

      • validateProperty

        default <T> Set<jakarta.validation.ConstraintViolation<T>> validateProperty​(T object,
                                                                                    String propertyName,
                                                                                    Class<?>... groups)
        Validates all constraints placed on the property of object named propertyName.
        Specified by:
        validateProperty in interface jakarta.validation.Validator
        Parameters:
        object - object to validate
        propertyName - property to validate (i.e. field and getter constraints). Nested properties may be referenced (e.g. prop[2].subpropA.subpropB)
        groups - group or list of groups targeted for validation (default to Default)
        Returns:
        constraint violations or an empty Set if none
        Throws:
        IllegalArgumentException - if object is null, if propertyName null, empty or not a valid object property or if null is passed to the varargs groups
        jakarta.validation.ValidationException - if a non recoverable error happens during the validation process
      • validateProperty

        <T> Set<jakarta.validation.ConstraintViolation<T>> validateProperty​(T object,
                                                                            String propertyName,
                                                                            boolean cascade,
                                                                            Class<?>... groups)
        Validates all constraints placed on the property of object named propertyName.
        Parameters:
        object - object to validate
        propertyName - property to validate (i.e. field and getter constraints). Nested properties may be referenced (e.g. prop[2].subpropA.subpropB)
        cascade - whether to cascade along Valid properties
        groups - group or list of groups targeted for validation (default to Default)
        Returns:
        constraint violations or an empty Set if none
        Throws:
        IllegalArgumentException - if object is null, if propertyName null, empty or not a valid object property or if null is passed to the varargs groups
        jakarta.validation.ValidationException - if a non recoverable error happens during the validation process
      • validateValue

        default <T> Set<jakarta.validation.ConstraintViolation<T>> validateValue​(Class<T> beanType,
                                                                                 String propertyName,
                                                                                 Object value,
                                                                                 Class<?>... groups)
        Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.

        ConstraintViolation objects return null for ConstraintViolation.getRootBean() and ConstraintViolation.getLeafBean().

        Specified by:
        validateValue in interface jakarta.validation.Validator
        Parameters:
        beanType - the bean type
        propertyName - property to validate
        value - property value to validate
        groups - group or list of groups targeted for validation (default to Default)
        Returns:
        constraint violations or an empty Set if none
        Throws:
        IllegalArgumentException - if beanType is null, if propertyName null, empty or not a valid object property or if null is passed to the varargs groups
        jakarta.validation.ValidationException - if a non recoverable error happens during the validation process
      • validateValue

        <T> Set<jakarta.validation.ConstraintViolation<T>> validateValue​(Class<T> beanType,
                                                                         String propertyName,
                                                                         Object value,
                                                                         boolean cascade,
                                                                         Class<?>... groups)
        Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.

        ConstraintViolation objects return null for ConstraintViolation.getRootBean() and ConstraintViolation.getLeafBean().

        Parameters:
        beanType - the bean type
        propertyName - property to validate
        value - property value to validate
        groups - group or list of groups targeted for validation (default to Default)
        Returns:
        constraint violations or an empty Set if none
        Throws:
        IllegalArgumentException - if beanType is null, if propertyName null, empty or not a valid object property or if null is passed to the varargs groups
        jakarta.validation.ValidationException - if a non recoverable error happens during the validation process