Class ConstraintViolations


  • public class ConstraintViolations
    extends Object
    This class provides static methods to work with constraint violations.
    • Method Detail

      • format

        public static <T> String format​(javax.validation.ConstraintViolation<T> v)
        Computes a string representation from a ConstraintViolation.
        Type Parameters:
        T - the generic type of the constraint violation
        Parameters:
        v - the constraint violation
        Returns:
        the formatted message
      • format

        public static <T> Collection<String> format​(Set<javax.validation.ConstraintViolation<T>> violations)
        Computes a set of formatted messages from the given typed set of ConstraintViolations.
        Type Parameters:
        T - the generic type of the constraint violations
        Parameters:
        violations - the constraint violations to format
        Returns:
        a new set containing the formatted messages
      • formatUntyped

        public static Collection<String> formatUntyped​(Set<javax.validation.ConstraintViolation<?>> violations)
        Computes a set of formatted messages from the given untyped set of ConstraintViolations.
        Parameters:
        violations - the constraint violations to format
        Returns:
        a new set containing the formatted messages
      • copyOf

        public static <T> Set<javax.validation.ConstraintViolation<?>> copyOf​(Set<javax.validation.ConstraintViolation<T>> violations)
        Copies a set of ConstraintViolations.
        Type Parameters:
        T - the generic type of the constraint violations
        Parameters:
        violations - the source set
        Returns:
        a new HashSet containing the violations from the source set