Class ConstraintViolations

java.lang.Object
io.dropwizard.validation.ConstraintViolations

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

    Modifier and Type
    Method
    Description
    static <T> Set<jakarta.validation.ConstraintViolation<?>>
    copyOf(Set<jakarta.validation.ConstraintViolation<T>> violations)
    Copies a set of ConstraintViolations.
    static <T> String
    format(jakarta.validation.ConstraintViolation<T> v)
    Computes a string representation from a ConstraintViolation.
    static <T> Collection<String>
    format(Set<jakarta.validation.ConstraintViolation<T>> violations)
    Computes a set of formatted messages from the given typed set of ConstraintViolations.
    formatUntyped(Set<jakarta.validation.ConstraintViolation<?>> violations)
    Computes a set of formatted messages from the given untyped set of ConstraintViolations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • format

      public static <T> String format(jakarta.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<jakarta.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<jakarta.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<jakarta.validation.ConstraintViolation<?>> copyOf(Set<jakarta.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