Interface GwtSpecificValidator<G>

  • Type Parameters:
    G - the type of bean for this validator
    All Known Implementing Classes:
    AbstractGwtSpecificValidator

    public interface GwtSpecificValidator<G>
    Defines GWT version of Validator. This used by generate a specific Validator for a given class G.
    • Method Detail

      • expandDefaultAndValidateClassGroups

        <T> void expandDefaultAndValidateClassGroups​(GwtValidationContext<T> context,
                                                     G object,
                                                     Set<javax.validation.ConstraintViolation<T>> violations,
                                                     Group... groups)
        Helper method used to first expand the Default group sequence and then perform validation of a bean using the specific group(s).
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - GWT validation context.
        object - Object being validated.
        violations - Set of violations to add to.
        groups - What group(s) to validate.
      • expandDefaultAndValidatePropertyGroups

        <T> void expandDefaultAndValidatePropertyGroups​(GwtValidationContext<T> context,
                                                        G object,
                                                        String propertyName,
                                                        Set<javax.validation.ConstraintViolation<T>> violations,
                                                        Group... groups)
        Helper method used to first expand the Default group sequence and then perform validation of a bean using the specific group(s).
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - GWT validation context.
        object - Object being validated.
        propertyName - The name of the property being validated.
        violations - Set of violations to add to.
        groups - What group(s) to validate.
      • expandDefaultAndValidateValueGroups

        <T> void expandDefaultAndValidateValueGroups​(GwtValidationContext<T> context,
                                                     Class<G> beanType,
                                                     String propertyName,
                                                     Object value,
                                                     Set<javax.validation.ConstraintViolation<T>> violations,
                                                     Group... groups)
        Helper method used to first expand the Default group sequence and then perform validation of a bean using the specific group(s).
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - GWT validation context.
        beanType - Class being validated.
        propertyName - The name of the property being validated.
        value - The value of the property to use.
        violations - Set of violations to add to.
        groups - What group(s) to validate.
      • getBeanMetadata

        BeanMetadata getBeanMetadata()
        Getter for bean metadata.
        Returns:
        The metadata for the bean class associated with this valdiator.
      • getConstraints

        GwtBeanDescriptor<G> getConstraints​(ValidationGroupsMetadata validationGroupsMetadata)
                                     throws javax.validation.ValidationException
        Return the descriptor object describing bean constraints. The returned object (and associated objects including ConstraintDescriptors) are immutable.
        Parameters:
        validationGroupsMetadata - The validation groups metadata for the validator.
        Returns:
        the bean descriptor for the class associated with this validator.
        Throws:
        IllegalArgumentException - if clazz is null
        javax.validation.ValidationException - if a non recoverable error happens during the metadata discovery or if some constraints are invalid.
      • validate

        <T> Set<javax.validation.ConstraintViolation<T>> validate​(GwtValidationContext<T> context,
                                                                  G object,
                                                                  Class<?>... groups)
                                                           throws javax.validation.ValidationException
        Validates all constraints on object.
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - The gwt validation context
        object - object 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 object is null or if null is passed to the varargs groups
        javax.validation.ValidationException - if a non recoverable error happens during the validation process
      • validateClassGroups

        <T> void validateClassGroups​(GwtValidationContext<T> context,
                                     G object,
                                     Set<javax.validation.ConstraintViolation<T>> violations,
                                     Class<?>... groups)
        Helper method used to perform validation of a bean using specific group(s). Does not expand the Default group seqeunce if it is redefined.
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - GWT validation context.
        object - Object being validated.
        violations - Set of violations to add to.
        groups - What group(s) to validate.
      • validateProperty

        <T> Set<javax.validation.ConstraintViolation<T>> validateProperty​(GwtValidationContext<T> context,
                                                                          G object,
                                                                          String propertyName,
                                                                          Class<?>... groups)
                                                                   throws javax.validation.ValidationException
        Validates all constraints placed on the property of object named propertyName.
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - The gwt validation context
        object - object to validate
        propertyName - property to validate (ie field and getter constraints)
        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
        javax.validation.ValidationException - if a non recoverable error happens during the validation process
      • validatePropertyGroups

        <T> void validatePropertyGroups​(GwtValidationContext<T> context,
                                        G object,
                                        String propertyName,
                                        Set<javax.validation.ConstraintViolation<T>> violations,
                                        Class<?>... groups)
        Helper method used to perform validation of a bean property using specific group(s).
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - GWT validation context.
        object - Object with property being validated.
        propertyName - Name of property to validate.
        violations - Set of violations to add to.
        groups - What group(s) to validate.
      • validateValue

        <T> Set<javax.validation.ConstraintViolation<T>> validateValue​(GwtValidationContext<T> context,
                                                                       Class<G> beanType,
                                                                       String propertyName,
                                                                       Object value,
                                                                       Class<?>... groups)
                                                                throws javax.validation.ValidationException
        Validates all constraints placed on the property named propertyName of the class beanType where the property value is value.

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

        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - The gwt validation context
        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
        javax.validation.ValidationException - if a non recoverable error happens during the validation process
      • validateValueGroups

        <T> void validateValueGroups​(GwtValidationContext<T> context,
                                     Class<G> beanType,
                                     String propertyName,
                                     Object value,
                                     Set<javax.validation.ConstraintViolation<T>> violations,
                                     Class<?>... groups)
        Helper method used to perform validation of a class property with a specified value using specific group(s).
        Type Parameters:
        T - the type of the RootBean for this validation context
        Parameters:
        context - GWT validation context.
        beanType - Class with property being validated.
        propertyName - Name of property to validate.
        value - The value of the property to use.
        violations - Set of violations to add to.
        groups - What group(s) to validate.