Class ValidationImpl

  • All Implemented Interfaces:
    Validation

    public class ValidationImpl
    extends Object
    implements Validation
    Validation object
    Author:
    James Roper, Philip Sommer, Jonathan Lannoy
    • Constructor Detail

      • ValidationImpl

        public ValidationImpl()
    • Method Detail

      • hasViolations

        public boolean hasViolations()
        Description copied from interface: Validation
        Whether the validation context has violations (including field and bean violations)
        Specified by:
        hasViolations in interface Validation
        Returns:
        True if it does
      • hasViolation

        public boolean hasViolation​(String paramName)
        Description copied from interface: Validation
        Whether the validation context has a violation for the given field
        Specified by:
        hasViolation in interface Validation
        Returns:
        True if it does
      • addFieldViolation

        public void addFieldViolation​(String field,
                                      ConstraintViolation constraintViolation)
        Description copied from interface: Validation
        Add a violation to the given field
        Specified by:
        addFieldViolation in interface Validation
        Parameters:
        field - The field to add the violation to
        constraintViolation - The constraint violation
      • hasFieldViolation

        public boolean hasFieldViolation​(String field)
        Description copied from interface: Validation
        Whether the validation context has a violation for the given field
        Specified by:
        hasFieldViolation in interface Validation
        Returns:
        True if it does
      • getFieldViolations

        public List<FieldViolation> getFieldViolations()
        Description copied from interface: Validation
        Get a complete list of all field violations. This list DOES NOT contain general violations (use getGeneralViolations() instead).
        Specified by:
        getFieldViolations in interface Validation
        Returns:
        A List of FieldViolation-objects
      • getFieldViolations

        public List<FieldViolation> getFieldViolations​(String field)
        Description copied from interface: Validation
        Get a complete list of field violations for a specified field. This list DOES NOT contain general violations (use getGeneralViolations() instead).
        Specified by:
        getFieldViolations in interface Validation
        Returns:
        A List of FieldViolation-objects
      • addBeanViolation

        public void addBeanViolation​(FieldViolation fieldViolation)
        Description copied from interface: Validation
        Add a bean violation. A bean, like a DTO consists of several fields which are validated. Each validation error of a dto-field results in a field-violation for that bean. Note: For now, you can only have one bean in your controller method signature, so this is explicit.
        Specified by:
        addBeanViolation in interface Validation
        Parameters:
        fieldViolation - the FieldViolation consisting of a cinstraintViolation and the fields name
      • hasBeanViolation

        public boolean hasBeanViolation​(String field)
        Description copied from interface: Validation
        Checks if the validation has bean violation.
        Specified by:
        hasBeanViolation in interface Validation
        Parameters:
        field - Name of the bean.
        Returns:
        Whether the named bean has violation.
      • hasBeanViolations

        public boolean hasBeanViolations()
        Description copied from interface: Validation
        Whether any violation occured while validating your beans Note: For now, you can only have one bean in your controller method signature, so this is explicit.
        Specified by:
        hasBeanViolations in interface Validation
        Returns:
        true if there are any, false if none
      • getBeanViolations

        public List<FieldViolation> getBeanViolations()
        Description copied from interface: Validation
        Get all bean validations for that bean. Note: For now, you can only have one bean in your controller method signature, so this is explicit.
        Specified by:
        getBeanViolations in interface Validation
        Returns:
        A list of field violations
      • getBeanViolations

        public List<FieldViolation> getBeanViolations​(String field)
        Description copied from interface: Validation
        Get a complete list of bean violations for a specified field. This list DOES NOT contain general violations (use getGeneralViolations() instead).
        Specified by:
        getBeanViolations in interface Validation
        Returns:
        A List of FieldViolation-objects
      • getGeneralViolations

        public List<ConstraintViolation> getGeneralViolations()
        Description copied from interface: Validation
        Get all general constraint violations. This list does not contain any specific field violation (use getFieldViolations() instead).
        Specified by:
        getGeneralViolations in interface Validation
        Returns:
        The list of general violations.