Class AbstractGwtSpecificValidator<G>

java.lang.Object
de.knightsoftnet.validators.client.impl.AbstractGwtSpecificValidator<G>
Type Parameters:
G - the type object to validate
All Implemented Interfaces:
GwtSpecificValidator<G>

public abstract class AbstractGwtSpecificValidator<G> extends Object implements GwtSpecificValidator<G>
Base methods for implementing a GwtSpecificValidator.

All methods that do not need to be generated go here.

  • Constructor Details

    • AbstractGwtSpecificValidator

      public AbstractGwtSpecificValidator()
  • Method Details

    • attributeBuilder

      public static AbstractGwtSpecificValidator.AttributeBuilder attributeBuilder()
    • groupsToClasses

      protected static Class<?>[] groupsToClasses(Group... groups)
    • validate

      public <T> Set<javax.validation.ConstraintViolation<T>> validate(GwtValidationContext<T> context, G object, Class<?>... groups)
      Description copied from interface: GwtSpecificValidator
      Validates all constraints on object.
      Specified by:
      validate in interface GwtSpecificValidator<G>
      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
    • validate

      protected <A extends Annotation, T, V> boolean validate(GwtValidationContext<T> context, Set<javax.validation.ConstraintViolation<T>> violations, G object, V value, javax.validation.ConstraintValidator<A,? super V> validator, ConstraintDescriptorImpl<A> constraintDescriptor, Class<?>... groups)
      Perform the actual validation of a single ConstraintValidator.

      As a side effect ConstraintViolations may be added to violations.

      Type Parameters:
      A - the type of the annotation
      T - the type of the class to validate
      V - the type of the value to validate
      Parameters:
      context - validation context
      violations - set of violations
      object - object
      value - value to validate
      validator - validator to use
      constraintDescriptor - constraint descriptor
      groups - validation groups to take care of
      Returns:
      true if there was any constraint violations
    • validateProperty

      public <T> Set<javax.validation.ConstraintViolation<T>> validateProperty(GwtValidationContext<T> context, G object, String propertyName, Class<?>... groups) throws javax.validation.ValidationException
      Description copied from interface: GwtSpecificValidator
      Validates all constraints placed on the property of object named propertyName.
      Specified by:
      validateProperty in interface GwtSpecificValidator<G>
      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:
      javax.validation.ValidationException - if a non recoverable error happens during the validation process
    • validateValue

      public <T> Set<javax.validation.ConstraintViolation<T>> validateValue(GwtValidationContext<T> context, Class<G> beanType, String propertyName, Object value, Class<?>... groups) throws javax.validation.ValidationException
      Description copied from interface: GwtSpecificValidator
      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()

      Specified by:
      validateValue in interface GwtSpecificValidator<G>
      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:
      javax.validation.ValidationException - if a non recoverable error happens during the validation process
    • addDefaultGroupWhenEmpty

      protected List<Class<?>> addDefaultGroupWhenEmpty(List<Class<?>> pgroups)
    • addSingleViolation

      protected <V, T, A extends Annotation> void addSingleViolation(GwtValidationContext<T> context, Set<javax.validation.ConstraintViolation<T>> violations, G object, V value, ConstraintDescriptorImpl<A> constraintDescriptor)